
obj/user/dumbfork.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 ad 01 00 00       	call   8001de <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <duppage>:
	}
}

void
duppage(envid_t dstenv, void *addr)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	56                   	push   %esi
  80003b:	53                   	push   %ebx
  80003c:	8b 75 08             	mov    0x8(%ebp),%esi
  80003f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;

	// This is NOT what you should do in your fork.
	if ((r = sys_page_alloc(dstenv, addr, PTE_P|PTE_U|PTE_W)) < 0)
  800042:	83 ec 04             	sub    $0x4,%esp
  800045:	6a 07                	push   $0x7
  800047:	53                   	push   %ebx
  800048:	56                   	push   %esi
  800049:	e8 04 0d 00 00       	call   800d52 <sys_page_alloc>
  80004e:	83 c4 10             	add    $0x10,%esp
  800051:	85 c0                	test   %eax,%eax
  800053:	78 4a                	js     80009f <duppage+0x6c>
		panic("sys_page_alloc: %e", r);
	if ((r = sys_page_map(dstenv, addr, 0, UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
  800055:	83 ec 0c             	sub    $0xc,%esp
  800058:	6a 07                	push   $0x7
  80005a:	68 00 00 40 00       	push   $0x400000
  80005f:	6a 00                	push   $0x0
  800061:	53                   	push   %ebx
  800062:	56                   	push   %esi
  800063:	e8 31 0d 00 00       	call   800d99 <sys_page_map>
  800068:	83 c4 20             	add    $0x20,%esp
  80006b:	85 c0                	test   %eax,%eax
  80006d:	78 42                	js     8000b1 <duppage+0x7e>
		panic("sys_page_map: %e", r);
	memmove(UTEMP, addr, PGSIZE);
  80006f:	83 ec 04             	sub    $0x4,%esp
  800072:	68 00 10 00 00       	push   $0x1000
  800077:	53                   	push   %ebx
  800078:	68 00 00 40 00       	push   $0x400000
  80007d:	e8 44 0a 00 00       	call   800ac6 <memmove>
	if ((r = sys_page_unmap(0, UTEMP)) < 0)
  800082:	83 c4 08             	add    $0x8,%esp
  800085:	68 00 00 40 00       	push   $0x400000
  80008a:	6a 00                	push   $0x0
  80008c:	e8 4e 0d 00 00       	call   800ddf <sys_page_unmap>
  800091:	83 c4 10             	add    $0x10,%esp
  800094:	85 c0                	test   %eax,%eax
  800096:	78 2b                	js     8000c3 <duppage+0x90>
		panic("sys_page_unmap: %e", r);
}
  800098:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80009b:	5b                   	pop    %ebx
  80009c:	5e                   	pop    %esi
  80009d:	5d                   	pop    %ebp
  80009e:	c3                   	ret    
		panic("sys_page_alloc: %e", r);
  80009f:	50                   	push   %eax
  8000a0:	68 60 20 80 00       	push   $0x802060
  8000a5:	6a 20                	push   $0x20
  8000a7:	68 73 20 80 00       	push   $0x802073
  8000ac:	e8 9f 01 00 00       	call   800250 <_panic>
		panic("sys_page_map: %e", r);
  8000b1:	50                   	push   %eax
  8000b2:	68 83 20 80 00       	push   $0x802083
  8000b7:	6a 22                	push   $0x22
  8000b9:	68 73 20 80 00       	push   $0x802073
  8000be:	e8 8d 01 00 00       	call   800250 <_panic>
		panic("sys_page_unmap: %e", r);
  8000c3:	50                   	push   %eax
  8000c4:	68 94 20 80 00       	push   $0x802094
  8000c9:	6a 25                	push   $0x25
  8000cb:	68 73 20 80 00       	push   $0x802073
  8000d0:	e8 7b 01 00 00       	call   800250 <_panic>

008000d5 <dumbfork>:

envid_t
dumbfork(void)
{
  8000d5:	f3 0f 1e fb          	endbr32 
  8000d9:	55                   	push   %ebp
  8000da:	89 e5                	mov    %esp,%ebp
  8000dc:	56                   	push   %esi
  8000dd:	53                   	push   %ebx
  8000de:	83 ec 10             	sub    $0x10,%esp
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  8000e1:	b8 07 00 00 00       	mov    $0x7,%eax
  8000e6:	cd 30                	int    $0x30
  8000e8:	89 c3                	mov    %eax,%ebx
	// The kernel will initialize it with a copy of our register state,
	// so that the child will appear to have called sys_exofork() too -
	// except that in the child, this "fake" call to sys_exofork()
	// will return 0 instead of the envid of the child.
	envid = sys_exofork();
	if (envid < 0)
  8000ea:	85 c0                	test   %eax,%eax
  8000ec:	78 0d                	js     8000fb <dumbfork+0x26>
  8000ee:	89 c6                	mov    %eax,%esi
		panic("sys_exofork: %e", envid);
	if (envid == 0) {
  8000f0:	74 1b                	je     80010d <dumbfork+0x38>
	}

	// We're the parent.
	// Eagerly copy our entire address space into the child.
	// This is NOT what you should do in your fork implementation.
	for (addr = (uint8_t*) UTEXT; addr < end; addr += PGSIZE)
  8000f2:	c7 45 f4 00 00 80 00 	movl   $0x800000,-0xc(%ebp)
  8000f9:	eb 3f                	jmp    80013a <dumbfork+0x65>
		panic("sys_exofork: %e", envid);
  8000fb:	50                   	push   %eax
  8000fc:	68 a7 20 80 00       	push   $0x8020a7
  800101:	6a 37                	push   $0x37
  800103:	68 73 20 80 00       	push   $0x802073
  800108:	e8 43 01 00 00       	call   800250 <_panic>
		thisenv = &envs[ENVX(sys_getenvid())];
  80010d:	e8 fa 0b 00 00       	call   800d0c <sys_getenvid>
  800112:	25 ff 03 00 00       	and    $0x3ff,%eax
  800117:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80011a:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80011f:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  800124:	eb 43                	jmp    800169 <dumbfork+0x94>
		duppage(envid, addr);
  800126:	83 ec 08             	sub    $0x8,%esp
  800129:	52                   	push   %edx
  80012a:	56                   	push   %esi
  80012b:	e8 03 ff ff ff       	call   800033 <duppage>
	for (addr = (uint8_t*) UTEXT; addr < end; addr += PGSIZE)
  800130:	81 45 f4 00 10 00 00 	addl   $0x1000,-0xc(%ebp)
  800137:	83 c4 10             	add    $0x10,%esp
  80013a:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80013d:	81 fa 00 60 80 00    	cmp    $0x806000,%edx
  800143:	72 e1                	jb     800126 <dumbfork+0x51>

	// Also copy the stack we are currently running on.
	duppage(envid, ROUNDDOWN(&addr, PGSIZE));
  800145:	83 ec 08             	sub    $0x8,%esp
  800148:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80014b:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800150:	50                   	push   %eax
  800151:	53                   	push   %ebx
  800152:	e8 dc fe ff ff       	call   800033 <duppage>

	// Start the child environment running
	if ((r = sys_env_set_status(envid, ENV_RUNNABLE)) < 0)
  800157:	83 c4 08             	add    $0x8,%esp
  80015a:	6a 02                	push   $0x2
  80015c:	53                   	push   %ebx
  80015d:	e8 c3 0c 00 00       	call   800e25 <sys_env_set_status>
  800162:	83 c4 10             	add    $0x10,%esp
  800165:	85 c0                	test   %eax,%eax
  800167:	78 09                	js     800172 <dumbfork+0x9d>
		panic("sys_env_set_status: %e", r);

	return envid;
}
  800169:	89 d8                	mov    %ebx,%eax
  80016b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80016e:	5b                   	pop    %ebx
  80016f:	5e                   	pop    %esi
  800170:	5d                   	pop    %ebp
  800171:	c3                   	ret    
		panic("sys_env_set_status: %e", r);
  800172:	50                   	push   %eax
  800173:	68 b7 20 80 00       	push   $0x8020b7
  800178:	6a 4c                	push   $0x4c
  80017a:	68 73 20 80 00       	push   $0x802073
  80017f:	e8 cc 00 00 00       	call   800250 <_panic>

00800184 <umain>:
{
  800184:	f3 0f 1e fb          	endbr32 
  800188:	55                   	push   %ebp
  800189:	89 e5                	mov    %esp,%ebp
  80018b:	57                   	push   %edi
  80018c:	56                   	push   %esi
  80018d:	53                   	push   %ebx
  80018e:	83 ec 0c             	sub    $0xc,%esp
	who = dumbfork();
  800191:	e8 3f ff ff ff       	call   8000d5 <dumbfork>
  800196:	89 c6                	mov    %eax,%esi
  800198:	85 c0                	test   %eax,%eax
  80019a:	bf ce 20 80 00       	mov    $0x8020ce,%edi
  80019f:	b8 d5 20 80 00       	mov    $0x8020d5,%eax
  8001a4:	0f 44 f8             	cmove  %eax,%edi
	for (i = 0; i < (who ? 10 : 20); i++) {
  8001a7:	bb 00 00 00 00       	mov    $0x0,%ebx
  8001ac:	eb 1f                	jmp    8001cd <umain+0x49>
  8001ae:	83 fb 13             	cmp    $0x13,%ebx
  8001b1:	7f 23                	jg     8001d6 <umain+0x52>
		cprintf("%d: I am the %s!\n", i, who ? "parent" : "child");
  8001b3:	83 ec 04             	sub    $0x4,%esp
  8001b6:	57                   	push   %edi
  8001b7:	53                   	push   %ebx
  8001b8:	68 db 20 80 00       	push   $0x8020db
  8001bd:	e8 75 01 00 00       	call   800337 <cprintf>
		sys_yield();
  8001c2:	e8 68 0b 00 00       	call   800d2f <sys_yield>
	for (i = 0; i < (who ? 10 : 20); i++) {
  8001c7:	83 c3 01             	add    $0x1,%ebx
  8001ca:	83 c4 10             	add    $0x10,%esp
  8001cd:	85 f6                	test   %esi,%esi
  8001cf:	74 dd                	je     8001ae <umain+0x2a>
  8001d1:	83 fb 09             	cmp    $0x9,%ebx
  8001d4:	7e dd                	jle    8001b3 <umain+0x2f>
}
  8001d6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8001d9:	5b                   	pop    %ebx
  8001da:	5e                   	pop    %esi
  8001db:	5f                   	pop    %edi
  8001dc:	5d                   	pop    %ebp
  8001dd:	c3                   	ret    

008001de <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8001de:	f3 0f 1e fb          	endbr32 
  8001e2:	55                   	push   %ebp
  8001e3:	89 e5                	mov    %esp,%ebp
  8001e5:	56                   	push   %esi
  8001e6:	53                   	push   %ebx
  8001e7:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8001ea:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8001ed:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8001f4:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8001f7:	e8 10 0b 00 00       	call   800d0c <sys_getenvid>
  8001fc:	25 ff 03 00 00       	and    $0x3ff,%eax
  800201:	6b c0 7c             	imul   $0x7c,%eax,%eax
  800204:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800209:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  80020e:	85 db                	test   %ebx,%ebx
  800210:	7e 07                	jle    800219 <libmain+0x3b>
		binaryname = argv[0];
  800212:	8b 06                	mov    (%esi),%eax
  800214:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800219:	83 ec 08             	sub    $0x8,%esp
  80021c:	56                   	push   %esi
  80021d:	53                   	push   %ebx
  80021e:	e8 61 ff ff ff       	call   800184 <umain>

	// exit gracefully
	exit();
  800223:	e8 0a 00 00 00       	call   800232 <exit>
}
  800228:	83 c4 10             	add    $0x10,%esp
  80022b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80022e:	5b                   	pop    %ebx
  80022f:	5e                   	pop    %esi
  800230:	5d                   	pop    %ebp
  800231:	c3                   	ret    

00800232 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800232:	f3 0f 1e fb          	endbr32 
  800236:	55                   	push   %ebp
  800237:	89 e5                	mov    %esp,%ebp
  800239:	83 ec 08             	sub    $0x8,%esp
	close_all();
  80023c:	e8 11 0f 00 00       	call   801152 <close_all>
	sys_env_destroy(0);
  800241:	83 ec 0c             	sub    $0xc,%esp
  800244:	6a 00                	push   $0x0
  800246:	e8 7c 0a 00 00       	call   800cc7 <sys_env_destroy>
}
  80024b:	83 c4 10             	add    $0x10,%esp
  80024e:	c9                   	leave  
  80024f:	c3                   	ret    

00800250 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800250:	f3 0f 1e fb          	endbr32 
  800254:	55                   	push   %ebp
  800255:	89 e5                	mov    %esp,%ebp
  800257:	56                   	push   %esi
  800258:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800259:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  80025c:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800262:	e8 a5 0a 00 00       	call   800d0c <sys_getenvid>
  800267:	83 ec 0c             	sub    $0xc,%esp
  80026a:	ff 75 0c             	pushl  0xc(%ebp)
  80026d:	ff 75 08             	pushl  0x8(%ebp)
  800270:	56                   	push   %esi
  800271:	50                   	push   %eax
  800272:	68 f8 20 80 00       	push   $0x8020f8
  800277:	e8 bb 00 00 00       	call   800337 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80027c:	83 c4 18             	add    $0x18,%esp
  80027f:	53                   	push   %ebx
  800280:	ff 75 10             	pushl  0x10(%ebp)
  800283:	e8 5a 00 00 00       	call   8002e2 <vcprintf>
	cprintf("\n");
  800288:	c7 04 24 eb 20 80 00 	movl   $0x8020eb,(%esp)
  80028f:	e8 a3 00 00 00       	call   800337 <cprintf>
  800294:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800297:	cc                   	int3   
  800298:	eb fd                	jmp    800297 <_panic+0x47>

0080029a <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80029a:	f3 0f 1e fb          	endbr32 
  80029e:	55                   	push   %ebp
  80029f:	89 e5                	mov    %esp,%ebp
  8002a1:	53                   	push   %ebx
  8002a2:	83 ec 04             	sub    $0x4,%esp
  8002a5:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  8002a8:	8b 13                	mov    (%ebx),%edx
  8002aa:	8d 42 01             	lea    0x1(%edx),%eax
  8002ad:	89 03                	mov    %eax,(%ebx)
  8002af:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8002b2:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8002b6:	3d ff 00 00 00       	cmp    $0xff,%eax
  8002bb:	74 09                	je     8002c6 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8002bd:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8002c1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8002c4:	c9                   	leave  
  8002c5:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8002c6:	83 ec 08             	sub    $0x8,%esp
  8002c9:	68 ff 00 00 00       	push   $0xff
  8002ce:	8d 43 08             	lea    0x8(%ebx),%eax
  8002d1:	50                   	push   %eax
  8002d2:	e8 ab 09 00 00       	call   800c82 <sys_cputs>
		b->idx = 0;
  8002d7:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8002dd:	83 c4 10             	add    $0x10,%esp
  8002e0:	eb db                	jmp    8002bd <putch+0x23>

008002e2 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8002e2:	f3 0f 1e fb          	endbr32 
  8002e6:	55                   	push   %ebp
  8002e7:	89 e5                	mov    %esp,%ebp
  8002e9:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8002ef:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8002f6:	00 00 00 
	b.cnt = 0;
  8002f9:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800300:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800303:	ff 75 0c             	pushl  0xc(%ebp)
  800306:	ff 75 08             	pushl  0x8(%ebp)
  800309:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  80030f:	50                   	push   %eax
  800310:	68 9a 02 80 00       	push   $0x80029a
  800315:	e8 20 01 00 00       	call   80043a <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80031a:	83 c4 08             	add    $0x8,%esp
  80031d:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800323:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800329:	50                   	push   %eax
  80032a:	e8 53 09 00 00       	call   800c82 <sys_cputs>

	return b.cnt;
}
  80032f:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800335:	c9                   	leave  
  800336:	c3                   	ret    

00800337 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800337:	f3 0f 1e fb          	endbr32 
  80033b:	55                   	push   %ebp
  80033c:	89 e5                	mov    %esp,%ebp
  80033e:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800341:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800344:	50                   	push   %eax
  800345:	ff 75 08             	pushl  0x8(%ebp)
  800348:	e8 95 ff ff ff       	call   8002e2 <vcprintf>
	va_end(ap);

	return cnt;
}
  80034d:	c9                   	leave  
  80034e:	c3                   	ret    

0080034f <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80034f:	55                   	push   %ebp
  800350:	89 e5                	mov    %esp,%ebp
  800352:	57                   	push   %edi
  800353:	56                   	push   %esi
  800354:	53                   	push   %ebx
  800355:	83 ec 1c             	sub    $0x1c,%esp
  800358:	89 c7                	mov    %eax,%edi
  80035a:	89 d6                	mov    %edx,%esi
  80035c:	8b 45 08             	mov    0x8(%ebp),%eax
  80035f:	8b 55 0c             	mov    0xc(%ebp),%edx
  800362:	89 d1                	mov    %edx,%ecx
  800364:	89 c2                	mov    %eax,%edx
  800366:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800369:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80036c:	8b 45 10             	mov    0x10(%ebp),%eax
  80036f:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800372:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800375:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80037c:	39 c2                	cmp    %eax,%edx
  80037e:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800381:	72 3e                	jb     8003c1 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800383:	83 ec 0c             	sub    $0xc,%esp
  800386:	ff 75 18             	pushl  0x18(%ebp)
  800389:	83 eb 01             	sub    $0x1,%ebx
  80038c:	53                   	push   %ebx
  80038d:	50                   	push   %eax
  80038e:	83 ec 08             	sub    $0x8,%esp
  800391:	ff 75 e4             	pushl  -0x1c(%ebp)
  800394:	ff 75 e0             	pushl  -0x20(%ebp)
  800397:	ff 75 dc             	pushl  -0x24(%ebp)
  80039a:	ff 75 d8             	pushl  -0x28(%ebp)
  80039d:	e8 5e 1a 00 00       	call   801e00 <__udivdi3>
  8003a2:	83 c4 18             	add    $0x18,%esp
  8003a5:	52                   	push   %edx
  8003a6:	50                   	push   %eax
  8003a7:	89 f2                	mov    %esi,%edx
  8003a9:	89 f8                	mov    %edi,%eax
  8003ab:	e8 9f ff ff ff       	call   80034f <printnum>
  8003b0:	83 c4 20             	add    $0x20,%esp
  8003b3:	eb 13                	jmp    8003c8 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8003b5:	83 ec 08             	sub    $0x8,%esp
  8003b8:	56                   	push   %esi
  8003b9:	ff 75 18             	pushl  0x18(%ebp)
  8003bc:	ff d7                	call   *%edi
  8003be:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8003c1:	83 eb 01             	sub    $0x1,%ebx
  8003c4:	85 db                	test   %ebx,%ebx
  8003c6:	7f ed                	jg     8003b5 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8003c8:	83 ec 08             	sub    $0x8,%esp
  8003cb:	56                   	push   %esi
  8003cc:	83 ec 04             	sub    $0x4,%esp
  8003cf:	ff 75 e4             	pushl  -0x1c(%ebp)
  8003d2:	ff 75 e0             	pushl  -0x20(%ebp)
  8003d5:	ff 75 dc             	pushl  -0x24(%ebp)
  8003d8:	ff 75 d8             	pushl  -0x28(%ebp)
  8003db:	e8 30 1b 00 00       	call   801f10 <__umoddi3>
  8003e0:	83 c4 14             	add    $0x14,%esp
  8003e3:	0f be 80 1b 21 80 00 	movsbl 0x80211b(%eax),%eax
  8003ea:	50                   	push   %eax
  8003eb:	ff d7                	call   *%edi
}
  8003ed:	83 c4 10             	add    $0x10,%esp
  8003f0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8003f3:	5b                   	pop    %ebx
  8003f4:	5e                   	pop    %esi
  8003f5:	5f                   	pop    %edi
  8003f6:	5d                   	pop    %ebp
  8003f7:	c3                   	ret    

008003f8 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8003f8:	f3 0f 1e fb          	endbr32 
  8003fc:	55                   	push   %ebp
  8003fd:	89 e5                	mov    %esp,%ebp
  8003ff:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800402:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800406:	8b 10                	mov    (%eax),%edx
  800408:	3b 50 04             	cmp    0x4(%eax),%edx
  80040b:	73 0a                	jae    800417 <sprintputch+0x1f>
		*b->buf++ = ch;
  80040d:	8d 4a 01             	lea    0x1(%edx),%ecx
  800410:	89 08                	mov    %ecx,(%eax)
  800412:	8b 45 08             	mov    0x8(%ebp),%eax
  800415:	88 02                	mov    %al,(%edx)
}
  800417:	5d                   	pop    %ebp
  800418:	c3                   	ret    

00800419 <printfmt>:
{
  800419:	f3 0f 1e fb          	endbr32 
  80041d:	55                   	push   %ebp
  80041e:	89 e5                	mov    %esp,%ebp
  800420:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800423:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800426:	50                   	push   %eax
  800427:	ff 75 10             	pushl  0x10(%ebp)
  80042a:	ff 75 0c             	pushl  0xc(%ebp)
  80042d:	ff 75 08             	pushl  0x8(%ebp)
  800430:	e8 05 00 00 00       	call   80043a <vprintfmt>
}
  800435:	83 c4 10             	add    $0x10,%esp
  800438:	c9                   	leave  
  800439:	c3                   	ret    

0080043a <vprintfmt>:
{
  80043a:	f3 0f 1e fb          	endbr32 
  80043e:	55                   	push   %ebp
  80043f:	89 e5                	mov    %esp,%ebp
  800441:	57                   	push   %edi
  800442:	56                   	push   %esi
  800443:	53                   	push   %ebx
  800444:	83 ec 3c             	sub    $0x3c,%esp
  800447:	8b 75 08             	mov    0x8(%ebp),%esi
  80044a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80044d:	8b 7d 10             	mov    0x10(%ebp),%edi
  800450:	e9 5d 03 00 00       	jmp    8007b2 <vprintfmt+0x378>
		padc = ' ';
  800455:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800459:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800460:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800467:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80046e:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800473:	8d 47 01             	lea    0x1(%edi),%eax
  800476:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800479:	0f b6 17             	movzbl (%edi),%edx
  80047c:	8d 42 dd             	lea    -0x23(%edx),%eax
  80047f:	3c 55                	cmp    $0x55,%al
  800481:	0f 87 ae 03 00 00    	ja     800835 <vprintfmt+0x3fb>
  800487:	0f b6 c0             	movzbl %al,%eax
  80048a:	3e ff 24 85 60 22 80 	notrack jmp *0x802260(,%eax,4)
  800491:	00 
  800492:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800495:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800499:	eb d8                	jmp    800473 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80049b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80049e:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  8004a2:	eb cf                	jmp    800473 <vprintfmt+0x39>
  8004a4:	0f b6 d2             	movzbl %dl,%edx
  8004a7:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8004aa:	b8 00 00 00 00       	mov    $0x0,%eax
  8004af:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8004b2:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8004b5:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8004b9:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8004bc:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8004bf:	83 f9 09             	cmp    $0x9,%ecx
  8004c2:	77 55                	ja     800519 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8004c4:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8004c7:	eb e9                	jmp    8004b2 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8004c9:	8b 45 14             	mov    0x14(%ebp),%eax
  8004cc:	8b 00                	mov    (%eax),%eax
  8004ce:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004d1:	8b 45 14             	mov    0x14(%ebp),%eax
  8004d4:	8d 40 04             	lea    0x4(%eax),%eax
  8004d7:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004da:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8004dd:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004e1:	79 90                	jns    800473 <vprintfmt+0x39>
				width = precision, precision = -1;
  8004e3:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8004e6:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004e9:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8004f0:	eb 81                	jmp    800473 <vprintfmt+0x39>
  8004f2:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8004f5:	85 c0                	test   %eax,%eax
  8004f7:	ba 00 00 00 00       	mov    $0x0,%edx
  8004fc:	0f 49 d0             	cmovns %eax,%edx
  8004ff:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800502:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800505:	e9 69 ff ff ff       	jmp    800473 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80050a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  80050d:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800514:	e9 5a ff ff ff       	jmp    800473 <vprintfmt+0x39>
  800519:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80051c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80051f:	eb bc                	jmp    8004dd <vprintfmt+0xa3>
			lflag++;
  800521:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800524:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800527:	e9 47 ff ff ff       	jmp    800473 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80052c:	8b 45 14             	mov    0x14(%ebp),%eax
  80052f:	8d 78 04             	lea    0x4(%eax),%edi
  800532:	83 ec 08             	sub    $0x8,%esp
  800535:	53                   	push   %ebx
  800536:	ff 30                	pushl  (%eax)
  800538:	ff d6                	call   *%esi
			break;
  80053a:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80053d:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800540:	e9 6a 02 00 00       	jmp    8007af <vprintfmt+0x375>
			err = va_arg(ap, int);
  800545:	8b 45 14             	mov    0x14(%ebp),%eax
  800548:	8d 78 04             	lea    0x4(%eax),%edi
  80054b:	8b 00                	mov    (%eax),%eax
  80054d:	99                   	cltd   
  80054e:	31 d0                	xor    %edx,%eax
  800550:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800552:	83 f8 0f             	cmp    $0xf,%eax
  800555:	7f 23                	jg     80057a <vprintfmt+0x140>
  800557:	8b 14 85 c0 23 80 00 	mov    0x8023c0(,%eax,4),%edx
  80055e:	85 d2                	test   %edx,%edx
  800560:	74 18                	je     80057a <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800562:	52                   	push   %edx
  800563:	68 f1 24 80 00       	push   $0x8024f1
  800568:	53                   	push   %ebx
  800569:	56                   	push   %esi
  80056a:	e8 aa fe ff ff       	call   800419 <printfmt>
  80056f:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800572:	89 7d 14             	mov    %edi,0x14(%ebp)
  800575:	e9 35 02 00 00       	jmp    8007af <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80057a:	50                   	push   %eax
  80057b:	68 33 21 80 00       	push   $0x802133
  800580:	53                   	push   %ebx
  800581:	56                   	push   %esi
  800582:	e8 92 fe ff ff       	call   800419 <printfmt>
  800587:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80058a:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80058d:	e9 1d 02 00 00       	jmp    8007af <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800592:	8b 45 14             	mov    0x14(%ebp),%eax
  800595:	83 c0 04             	add    $0x4,%eax
  800598:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80059b:	8b 45 14             	mov    0x14(%ebp),%eax
  80059e:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  8005a0:	85 d2                	test   %edx,%edx
  8005a2:	b8 2c 21 80 00       	mov    $0x80212c,%eax
  8005a7:	0f 45 c2             	cmovne %edx,%eax
  8005aa:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8005ad:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8005b1:	7e 06                	jle    8005b9 <vprintfmt+0x17f>
  8005b3:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8005b7:	75 0d                	jne    8005c6 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8005b9:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8005bc:	89 c7                	mov    %eax,%edi
  8005be:	03 45 d4             	add    -0x2c(%ebp),%eax
  8005c1:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8005c4:	eb 55                	jmp    80061b <vprintfmt+0x1e1>
  8005c6:	83 ec 08             	sub    $0x8,%esp
  8005c9:	ff 75 d8             	pushl  -0x28(%ebp)
  8005cc:	ff 75 cc             	pushl  -0x34(%ebp)
  8005cf:	e8 15 03 00 00       	call   8008e9 <strnlen>
  8005d4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8005d7:	29 c2                	sub    %eax,%edx
  8005d9:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8005dc:	83 c4 10             	add    $0x10,%esp
  8005df:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8005e1:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8005e5:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8005e8:	85 ff                	test   %edi,%edi
  8005ea:	7e 11                	jle    8005fd <vprintfmt+0x1c3>
					putch(padc, putdat);
  8005ec:	83 ec 08             	sub    $0x8,%esp
  8005ef:	53                   	push   %ebx
  8005f0:	ff 75 d4             	pushl  -0x2c(%ebp)
  8005f3:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8005f5:	83 ef 01             	sub    $0x1,%edi
  8005f8:	83 c4 10             	add    $0x10,%esp
  8005fb:	eb eb                	jmp    8005e8 <vprintfmt+0x1ae>
  8005fd:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800600:	85 d2                	test   %edx,%edx
  800602:	b8 00 00 00 00       	mov    $0x0,%eax
  800607:	0f 49 c2             	cmovns %edx,%eax
  80060a:	29 c2                	sub    %eax,%edx
  80060c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  80060f:	eb a8                	jmp    8005b9 <vprintfmt+0x17f>
					putch(ch, putdat);
  800611:	83 ec 08             	sub    $0x8,%esp
  800614:	53                   	push   %ebx
  800615:	52                   	push   %edx
  800616:	ff d6                	call   *%esi
  800618:	83 c4 10             	add    $0x10,%esp
  80061b:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80061e:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800620:	83 c7 01             	add    $0x1,%edi
  800623:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800627:	0f be d0             	movsbl %al,%edx
  80062a:	85 d2                	test   %edx,%edx
  80062c:	74 4b                	je     800679 <vprintfmt+0x23f>
  80062e:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800632:	78 06                	js     80063a <vprintfmt+0x200>
  800634:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800638:	78 1e                	js     800658 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80063a:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80063e:	74 d1                	je     800611 <vprintfmt+0x1d7>
  800640:	0f be c0             	movsbl %al,%eax
  800643:	83 e8 20             	sub    $0x20,%eax
  800646:	83 f8 5e             	cmp    $0x5e,%eax
  800649:	76 c6                	jbe    800611 <vprintfmt+0x1d7>
					putch('?', putdat);
  80064b:	83 ec 08             	sub    $0x8,%esp
  80064e:	53                   	push   %ebx
  80064f:	6a 3f                	push   $0x3f
  800651:	ff d6                	call   *%esi
  800653:	83 c4 10             	add    $0x10,%esp
  800656:	eb c3                	jmp    80061b <vprintfmt+0x1e1>
  800658:	89 cf                	mov    %ecx,%edi
  80065a:	eb 0e                	jmp    80066a <vprintfmt+0x230>
				putch(' ', putdat);
  80065c:	83 ec 08             	sub    $0x8,%esp
  80065f:	53                   	push   %ebx
  800660:	6a 20                	push   $0x20
  800662:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800664:	83 ef 01             	sub    $0x1,%edi
  800667:	83 c4 10             	add    $0x10,%esp
  80066a:	85 ff                	test   %edi,%edi
  80066c:	7f ee                	jg     80065c <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80066e:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800671:	89 45 14             	mov    %eax,0x14(%ebp)
  800674:	e9 36 01 00 00       	jmp    8007af <vprintfmt+0x375>
  800679:	89 cf                	mov    %ecx,%edi
  80067b:	eb ed                	jmp    80066a <vprintfmt+0x230>
	if (lflag >= 2)
  80067d:	83 f9 01             	cmp    $0x1,%ecx
  800680:	7f 1f                	jg     8006a1 <vprintfmt+0x267>
	else if (lflag)
  800682:	85 c9                	test   %ecx,%ecx
  800684:	74 67                	je     8006ed <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800686:	8b 45 14             	mov    0x14(%ebp),%eax
  800689:	8b 00                	mov    (%eax),%eax
  80068b:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80068e:	89 c1                	mov    %eax,%ecx
  800690:	c1 f9 1f             	sar    $0x1f,%ecx
  800693:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800696:	8b 45 14             	mov    0x14(%ebp),%eax
  800699:	8d 40 04             	lea    0x4(%eax),%eax
  80069c:	89 45 14             	mov    %eax,0x14(%ebp)
  80069f:	eb 17                	jmp    8006b8 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  8006a1:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a4:	8b 50 04             	mov    0x4(%eax),%edx
  8006a7:	8b 00                	mov    (%eax),%eax
  8006a9:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006ac:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006af:	8b 45 14             	mov    0x14(%ebp),%eax
  8006b2:	8d 40 08             	lea    0x8(%eax),%eax
  8006b5:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8006b8:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006bb:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8006be:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8006c3:	85 c9                	test   %ecx,%ecx
  8006c5:	0f 89 ca 00 00 00    	jns    800795 <vprintfmt+0x35b>
				putch('-', putdat);
  8006cb:	83 ec 08             	sub    $0x8,%esp
  8006ce:	53                   	push   %ebx
  8006cf:	6a 2d                	push   $0x2d
  8006d1:	ff d6                	call   *%esi
				num = -(long long) num;
  8006d3:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006d6:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8006d9:	f7 da                	neg    %edx
  8006db:	83 d1 00             	adc    $0x0,%ecx
  8006de:	f7 d9                	neg    %ecx
  8006e0:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8006e3:	b8 0a 00 00 00       	mov    $0xa,%eax
  8006e8:	e9 a8 00 00 00       	jmp    800795 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8006ed:	8b 45 14             	mov    0x14(%ebp),%eax
  8006f0:	8b 00                	mov    (%eax),%eax
  8006f2:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006f5:	99                   	cltd   
  8006f6:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006f9:	8b 45 14             	mov    0x14(%ebp),%eax
  8006fc:	8d 40 04             	lea    0x4(%eax),%eax
  8006ff:	89 45 14             	mov    %eax,0x14(%ebp)
  800702:	eb b4                	jmp    8006b8 <vprintfmt+0x27e>
	if (lflag >= 2)
  800704:	83 f9 01             	cmp    $0x1,%ecx
  800707:	7f 1b                	jg     800724 <vprintfmt+0x2ea>
	else if (lflag)
  800709:	85 c9                	test   %ecx,%ecx
  80070b:	74 2c                	je     800739 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80070d:	8b 45 14             	mov    0x14(%ebp),%eax
  800710:	8b 10                	mov    (%eax),%edx
  800712:	b9 00 00 00 00       	mov    $0x0,%ecx
  800717:	8d 40 04             	lea    0x4(%eax),%eax
  80071a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80071d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800722:	eb 71                	jmp    800795 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800724:	8b 45 14             	mov    0x14(%ebp),%eax
  800727:	8b 10                	mov    (%eax),%edx
  800729:	8b 48 04             	mov    0x4(%eax),%ecx
  80072c:	8d 40 08             	lea    0x8(%eax),%eax
  80072f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800732:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800737:	eb 5c                	jmp    800795 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800739:	8b 45 14             	mov    0x14(%ebp),%eax
  80073c:	8b 10                	mov    (%eax),%edx
  80073e:	b9 00 00 00 00       	mov    $0x0,%ecx
  800743:	8d 40 04             	lea    0x4(%eax),%eax
  800746:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800749:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80074e:	eb 45                	jmp    800795 <vprintfmt+0x35b>
			putch('X', putdat);
  800750:	83 ec 08             	sub    $0x8,%esp
  800753:	53                   	push   %ebx
  800754:	6a 58                	push   $0x58
  800756:	ff d6                	call   *%esi
			putch('X', putdat);
  800758:	83 c4 08             	add    $0x8,%esp
  80075b:	53                   	push   %ebx
  80075c:	6a 58                	push   $0x58
  80075e:	ff d6                	call   *%esi
			putch('X', putdat);
  800760:	83 c4 08             	add    $0x8,%esp
  800763:	53                   	push   %ebx
  800764:	6a 58                	push   $0x58
  800766:	ff d6                	call   *%esi
			break;
  800768:	83 c4 10             	add    $0x10,%esp
  80076b:	eb 42                	jmp    8007af <vprintfmt+0x375>
			putch('0', putdat);
  80076d:	83 ec 08             	sub    $0x8,%esp
  800770:	53                   	push   %ebx
  800771:	6a 30                	push   $0x30
  800773:	ff d6                	call   *%esi
			putch('x', putdat);
  800775:	83 c4 08             	add    $0x8,%esp
  800778:	53                   	push   %ebx
  800779:	6a 78                	push   $0x78
  80077b:	ff d6                	call   *%esi
			num = (unsigned long long)
  80077d:	8b 45 14             	mov    0x14(%ebp),%eax
  800780:	8b 10                	mov    (%eax),%edx
  800782:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800787:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80078a:	8d 40 04             	lea    0x4(%eax),%eax
  80078d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800790:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800795:	83 ec 0c             	sub    $0xc,%esp
  800798:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80079c:	57                   	push   %edi
  80079d:	ff 75 d4             	pushl  -0x2c(%ebp)
  8007a0:	50                   	push   %eax
  8007a1:	51                   	push   %ecx
  8007a2:	52                   	push   %edx
  8007a3:	89 da                	mov    %ebx,%edx
  8007a5:	89 f0                	mov    %esi,%eax
  8007a7:	e8 a3 fb ff ff       	call   80034f <printnum>
			break;
  8007ac:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8007af:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8007b2:	83 c7 01             	add    $0x1,%edi
  8007b5:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8007b9:	83 f8 25             	cmp    $0x25,%eax
  8007bc:	0f 84 93 fc ff ff    	je     800455 <vprintfmt+0x1b>
			if (ch == '\0')
  8007c2:	85 c0                	test   %eax,%eax
  8007c4:	0f 84 8b 00 00 00    	je     800855 <vprintfmt+0x41b>
			putch(ch, putdat);
  8007ca:	83 ec 08             	sub    $0x8,%esp
  8007cd:	53                   	push   %ebx
  8007ce:	50                   	push   %eax
  8007cf:	ff d6                	call   *%esi
  8007d1:	83 c4 10             	add    $0x10,%esp
  8007d4:	eb dc                	jmp    8007b2 <vprintfmt+0x378>
	if (lflag >= 2)
  8007d6:	83 f9 01             	cmp    $0x1,%ecx
  8007d9:	7f 1b                	jg     8007f6 <vprintfmt+0x3bc>
	else if (lflag)
  8007db:	85 c9                	test   %ecx,%ecx
  8007dd:	74 2c                	je     80080b <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8007df:	8b 45 14             	mov    0x14(%ebp),%eax
  8007e2:	8b 10                	mov    (%eax),%edx
  8007e4:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007e9:	8d 40 04             	lea    0x4(%eax),%eax
  8007ec:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007ef:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8007f4:	eb 9f                	jmp    800795 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8007f6:	8b 45 14             	mov    0x14(%ebp),%eax
  8007f9:	8b 10                	mov    (%eax),%edx
  8007fb:	8b 48 04             	mov    0x4(%eax),%ecx
  8007fe:	8d 40 08             	lea    0x8(%eax),%eax
  800801:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800804:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800809:	eb 8a                	jmp    800795 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80080b:	8b 45 14             	mov    0x14(%ebp),%eax
  80080e:	8b 10                	mov    (%eax),%edx
  800810:	b9 00 00 00 00       	mov    $0x0,%ecx
  800815:	8d 40 04             	lea    0x4(%eax),%eax
  800818:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80081b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800820:	e9 70 ff ff ff       	jmp    800795 <vprintfmt+0x35b>
			putch(ch, putdat);
  800825:	83 ec 08             	sub    $0x8,%esp
  800828:	53                   	push   %ebx
  800829:	6a 25                	push   $0x25
  80082b:	ff d6                	call   *%esi
			break;
  80082d:	83 c4 10             	add    $0x10,%esp
  800830:	e9 7a ff ff ff       	jmp    8007af <vprintfmt+0x375>
			putch('%', putdat);
  800835:	83 ec 08             	sub    $0x8,%esp
  800838:	53                   	push   %ebx
  800839:	6a 25                	push   $0x25
  80083b:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80083d:	83 c4 10             	add    $0x10,%esp
  800840:	89 f8                	mov    %edi,%eax
  800842:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800846:	74 05                	je     80084d <vprintfmt+0x413>
  800848:	83 e8 01             	sub    $0x1,%eax
  80084b:	eb f5                	jmp    800842 <vprintfmt+0x408>
  80084d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800850:	e9 5a ff ff ff       	jmp    8007af <vprintfmt+0x375>
}
  800855:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800858:	5b                   	pop    %ebx
  800859:	5e                   	pop    %esi
  80085a:	5f                   	pop    %edi
  80085b:	5d                   	pop    %ebp
  80085c:	c3                   	ret    

0080085d <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80085d:	f3 0f 1e fb          	endbr32 
  800861:	55                   	push   %ebp
  800862:	89 e5                	mov    %esp,%ebp
  800864:	83 ec 18             	sub    $0x18,%esp
  800867:	8b 45 08             	mov    0x8(%ebp),%eax
  80086a:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80086d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800870:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800874:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800877:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80087e:	85 c0                	test   %eax,%eax
  800880:	74 26                	je     8008a8 <vsnprintf+0x4b>
  800882:	85 d2                	test   %edx,%edx
  800884:	7e 22                	jle    8008a8 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800886:	ff 75 14             	pushl  0x14(%ebp)
  800889:	ff 75 10             	pushl  0x10(%ebp)
  80088c:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80088f:	50                   	push   %eax
  800890:	68 f8 03 80 00       	push   $0x8003f8
  800895:	e8 a0 fb ff ff       	call   80043a <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80089a:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80089d:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  8008a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8008a3:	83 c4 10             	add    $0x10,%esp
}
  8008a6:	c9                   	leave  
  8008a7:	c3                   	ret    
		return -E_INVAL;
  8008a8:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8008ad:	eb f7                	jmp    8008a6 <vsnprintf+0x49>

008008af <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8008af:	f3 0f 1e fb          	endbr32 
  8008b3:	55                   	push   %ebp
  8008b4:	89 e5                	mov    %esp,%ebp
  8008b6:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8008b9:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8008bc:	50                   	push   %eax
  8008bd:	ff 75 10             	pushl  0x10(%ebp)
  8008c0:	ff 75 0c             	pushl  0xc(%ebp)
  8008c3:	ff 75 08             	pushl  0x8(%ebp)
  8008c6:	e8 92 ff ff ff       	call   80085d <vsnprintf>
	va_end(ap);

	return rc;
}
  8008cb:	c9                   	leave  
  8008cc:	c3                   	ret    

008008cd <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8008cd:	f3 0f 1e fb          	endbr32 
  8008d1:	55                   	push   %ebp
  8008d2:	89 e5                	mov    %esp,%ebp
  8008d4:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8008d7:	b8 00 00 00 00       	mov    $0x0,%eax
  8008dc:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8008e0:	74 05                	je     8008e7 <strlen+0x1a>
		n++;
  8008e2:	83 c0 01             	add    $0x1,%eax
  8008e5:	eb f5                	jmp    8008dc <strlen+0xf>
	return n;
}
  8008e7:	5d                   	pop    %ebp
  8008e8:	c3                   	ret    

008008e9 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8008e9:	f3 0f 1e fb          	endbr32 
  8008ed:	55                   	push   %ebp
  8008ee:	89 e5                	mov    %esp,%ebp
  8008f0:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008f3:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8008f6:	b8 00 00 00 00       	mov    $0x0,%eax
  8008fb:	39 d0                	cmp    %edx,%eax
  8008fd:	74 0d                	je     80090c <strnlen+0x23>
  8008ff:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800903:	74 05                	je     80090a <strnlen+0x21>
		n++;
  800905:	83 c0 01             	add    $0x1,%eax
  800908:	eb f1                	jmp    8008fb <strnlen+0x12>
  80090a:	89 c2                	mov    %eax,%edx
	return n;
}
  80090c:	89 d0                	mov    %edx,%eax
  80090e:	5d                   	pop    %ebp
  80090f:	c3                   	ret    

00800910 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800910:	f3 0f 1e fb          	endbr32 
  800914:	55                   	push   %ebp
  800915:	89 e5                	mov    %esp,%ebp
  800917:	53                   	push   %ebx
  800918:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80091b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80091e:	b8 00 00 00 00       	mov    $0x0,%eax
  800923:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800927:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80092a:	83 c0 01             	add    $0x1,%eax
  80092d:	84 d2                	test   %dl,%dl
  80092f:	75 f2                	jne    800923 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800931:	89 c8                	mov    %ecx,%eax
  800933:	5b                   	pop    %ebx
  800934:	5d                   	pop    %ebp
  800935:	c3                   	ret    

00800936 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800936:	f3 0f 1e fb          	endbr32 
  80093a:	55                   	push   %ebp
  80093b:	89 e5                	mov    %esp,%ebp
  80093d:	53                   	push   %ebx
  80093e:	83 ec 10             	sub    $0x10,%esp
  800941:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800944:	53                   	push   %ebx
  800945:	e8 83 ff ff ff       	call   8008cd <strlen>
  80094a:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80094d:	ff 75 0c             	pushl  0xc(%ebp)
  800950:	01 d8                	add    %ebx,%eax
  800952:	50                   	push   %eax
  800953:	e8 b8 ff ff ff       	call   800910 <strcpy>
	return dst;
}
  800958:	89 d8                	mov    %ebx,%eax
  80095a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80095d:	c9                   	leave  
  80095e:	c3                   	ret    

0080095f <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80095f:	f3 0f 1e fb          	endbr32 
  800963:	55                   	push   %ebp
  800964:	89 e5                	mov    %esp,%ebp
  800966:	56                   	push   %esi
  800967:	53                   	push   %ebx
  800968:	8b 75 08             	mov    0x8(%ebp),%esi
  80096b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80096e:	89 f3                	mov    %esi,%ebx
  800970:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800973:	89 f0                	mov    %esi,%eax
  800975:	39 d8                	cmp    %ebx,%eax
  800977:	74 11                	je     80098a <strncpy+0x2b>
		*dst++ = *src;
  800979:	83 c0 01             	add    $0x1,%eax
  80097c:	0f b6 0a             	movzbl (%edx),%ecx
  80097f:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800982:	80 f9 01             	cmp    $0x1,%cl
  800985:	83 da ff             	sbb    $0xffffffff,%edx
  800988:	eb eb                	jmp    800975 <strncpy+0x16>
	}
	return ret;
}
  80098a:	89 f0                	mov    %esi,%eax
  80098c:	5b                   	pop    %ebx
  80098d:	5e                   	pop    %esi
  80098e:	5d                   	pop    %ebp
  80098f:	c3                   	ret    

00800990 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800990:	f3 0f 1e fb          	endbr32 
  800994:	55                   	push   %ebp
  800995:	89 e5                	mov    %esp,%ebp
  800997:	56                   	push   %esi
  800998:	53                   	push   %ebx
  800999:	8b 75 08             	mov    0x8(%ebp),%esi
  80099c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80099f:	8b 55 10             	mov    0x10(%ebp),%edx
  8009a2:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  8009a4:	85 d2                	test   %edx,%edx
  8009a6:	74 21                	je     8009c9 <strlcpy+0x39>
  8009a8:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8009ac:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8009ae:	39 c2                	cmp    %eax,%edx
  8009b0:	74 14                	je     8009c6 <strlcpy+0x36>
  8009b2:	0f b6 19             	movzbl (%ecx),%ebx
  8009b5:	84 db                	test   %bl,%bl
  8009b7:	74 0b                	je     8009c4 <strlcpy+0x34>
			*dst++ = *src++;
  8009b9:	83 c1 01             	add    $0x1,%ecx
  8009bc:	83 c2 01             	add    $0x1,%edx
  8009bf:	88 5a ff             	mov    %bl,-0x1(%edx)
  8009c2:	eb ea                	jmp    8009ae <strlcpy+0x1e>
  8009c4:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8009c6:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8009c9:	29 f0                	sub    %esi,%eax
}
  8009cb:	5b                   	pop    %ebx
  8009cc:	5e                   	pop    %esi
  8009cd:	5d                   	pop    %ebp
  8009ce:	c3                   	ret    

008009cf <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8009cf:	f3 0f 1e fb          	endbr32 
  8009d3:	55                   	push   %ebp
  8009d4:	89 e5                	mov    %esp,%ebp
  8009d6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8009d9:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8009dc:	0f b6 01             	movzbl (%ecx),%eax
  8009df:	84 c0                	test   %al,%al
  8009e1:	74 0c                	je     8009ef <strcmp+0x20>
  8009e3:	3a 02                	cmp    (%edx),%al
  8009e5:	75 08                	jne    8009ef <strcmp+0x20>
		p++, q++;
  8009e7:	83 c1 01             	add    $0x1,%ecx
  8009ea:	83 c2 01             	add    $0x1,%edx
  8009ed:	eb ed                	jmp    8009dc <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8009ef:	0f b6 c0             	movzbl %al,%eax
  8009f2:	0f b6 12             	movzbl (%edx),%edx
  8009f5:	29 d0                	sub    %edx,%eax
}
  8009f7:	5d                   	pop    %ebp
  8009f8:	c3                   	ret    

008009f9 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8009f9:	f3 0f 1e fb          	endbr32 
  8009fd:	55                   	push   %ebp
  8009fe:	89 e5                	mov    %esp,%ebp
  800a00:	53                   	push   %ebx
  800a01:	8b 45 08             	mov    0x8(%ebp),%eax
  800a04:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a07:	89 c3                	mov    %eax,%ebx
  800a09:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800a0c:	eb 06                	jmp    800a14 <strncmp+0x1b>
		n--, p++, q++;
  800a0e:	83 c0 01             	add    $0x1,%eax
  800a11:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800a14:	39 d8                	cmp    %ebx,%eax
  800a16:	74 16                	je     800a2e <strncmp+0x35>
  800a18:	0f b6 08             	movzbl (%eax),%ecx
  800a1b:	84 c9                	test   %cl,%cl
  800a1d:	74 04                	je     800a23 <strncmp+0x2a>
  800a1f:	3a 0a                	cmp    (%edx),%cl
  800a21:	74 eb                	je     800a0e <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800a23:	0f b6 00             	movzbl (%eax),%eax
  800a26:	0f b6 12             	movzbl (%edx),%edx
  800a29:	29 d0                	sub    %edx,%eax
}
  800a2b:	5b                   	pop    %ebx
  800a2c:	5d                   	pop    %ebp
  800a2d:	c3                   	ret    
		return 0;
  800a2e:	b8 00 00 00 00       	mov    $0x0,%eax
  800a33:	eb f6                	jmp    800a2b <strncmp+0x32>

00800a35 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800a35:	f3 0f 1e fb          	endbr32 
  800a39:	55                   	push   %ebp
  800a3a:	89 e5                	mov    %esp,%ebp
  800a3c:	8b 45 08             	mov    0x8(%ebp),%eax
  800a3f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a43:	0f b6 10             	movzbl (%eax),%edx
  800a46:	84 d2                	test   %dl,%dl
  800a48:	74 09                	je     800a53 <strchr+0x1e>
		if (*s == c)
  800a4a:	38 ca                	cmp    %cl,%dl
  800a4c:	74 0a                	je     800a58 <strchr+0x23>
	for (; *s; s++)
  800a4e:	83 c0 01             	add    $0x1,%eax
  800a51:	eb f0                	jmp    800a43 <strchr+0xe>
			return (char *) s;
	return 0;
  800a53:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a58:	5d                   	pop    %ebp
  800a59:	c3                   	ret    

00800a5a <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800a5a:	f3 0f 1e fb          	endbr32 
  800a5e:	55                   	push   %ebp
  800a5f:	89 e5                	mov    %esp,%ebp
  800a61:	8b 45 08             	mov    0x8(%ebp),%eax
  800a64:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a68:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800a6b:	38 ca                	cmp    %cl,%dl
  800a6d:	74 09                	je     800a78 <strfind+0x1e>
  800a6f:	84 d2                	test   %dl,%dl
  800a71:	74 05                	je     800a78 <strfind+0x1e>
	for (; *s; s++)
  800a73:	83 c0 01             	add    $0x1,%eax
  800a76:	eb f0                	jmp    800a68 <strfind+0xe>
			break;
	return (char *) s;
}
  800a78:	5d                   	pop    %ebp
  800a79:	c3                   	ret    

00800a7a <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800a7a:	f3 0f 1e fb          	endbr32 
  800a7e:	55                   	push   %ebp
  800a7f:	89 e5                	mov    %esp,%ebp
  800a81:	57                   	push   %edi
  800a82:	56                   	push   %esi
  800a83:	53                   	push   %ebx
  800a84:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a87:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a8a:	85 c9                	test   %ecx,%ecx
  800a8c:	74 31                	je     800abf <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800a8e:	89 f8                	mov    %edi,%eax
  800a90:	09 c8                	or     %ecx,%eax
  800a92:	a8 03                	test   $0x3,%al
  800a94:	75 23                	jne    800ab9 <memset+0x3f>
		c &= 0xFF;
  800a96:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800a9a:	89 d3                	mov    %edx,%ebx
  800a9c:	c1 e3 08             	shl    $0x8,%ebx
  800a9f:	89 d0                	mov    %edx,%eax
  800aa1:	c1 e0 18             	shl    $0x18,%eax
  800aa4:	89 d6                	mov    %edx,%esi
  800aa6:	c1 e6 10             	shl    $0x10,%esi
  800aa9:	09 f0                	or     %esi,%eax
  800aab:	09 c2                	or     %eax,%edx
  800aad:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800aaf:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800ab2:	89 d0                	mov    %edx,%eax
  800ab4:	fc                   	cld    
  800ab5:	f3 ab                	rep stos %eax,%es:(%edi)
  800ab7:	eb 06                	jmp    800abf <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800ab9:	8b 45 0c             	mov    0xc(%ebp),%eax
  800abc:	fc                   	cld    
  800abd:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800abf:	89 f8                	mov    %edi,%eax
  800ac1:	5b                   	pop    %ebx
  800ac2:	5e                   	pop    %esi
  800ac3:	5f                   	pop    %edi
  800ac4:	5d                   	pop    %ebp
  800ac5:	c3                   	ret    

00800ac6 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800ac6:	f3 0f 1e fb          	endbr32 
  800aca:	55                   	push   %ebp
  800acb:	89 e5                	mov    %esp,%ebp
  800acd:	57                   	push   %edi
  800ace:	56                   	push   %esi
  800acf:	8b 45 08             	mov    0x8(%ebp),%eax
  800ad2:	8b 75 0c             	mov    0xc(%ebp),%esi
  800ad5:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800ad8:	39 c6                	cmp    %eax,%esi
  800ada:	73 32                	jae    800b0e <memmove+0x48>
  800adc:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800adf:	39 c2                	cmp    %eax,%edx
  800ae1:	76 2b                	jbe    800b0e <memmove+0x48>
		s += n;
		d += n;
  800ae3:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800ae6:	89 fe                	mov    %edi,%esi
  800ae8:	09 ce                	or     %ecx,%esi
  800aea:	09 d6                	or     %edx,%esi
  800aec:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800af2:	75 0e                	jne    800b02 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800af4:	83 ef 04             	sub    $0x4,%edi
  800af7:	8d 72 fc             	lea    -0x4(%edx),%esi
  800afa:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800afd:	fd                   	std    
  800afe:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b00:	eb 09                	jmp    800b0b <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800b02:	83 ef 01             	sub    $0x1,%edi
  800b05:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800b08:	fd                   	std    
  800b09:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800b0b:	fc                   	cld    
  800b0c:	eb 1a                	jmp    800b28 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800b0e:	89 c2                	mov    %eax,%edx
  800b10:	09 ca                	or     %ecx,%edx
  800b12:	09 f2                	or     %esi,%edx
  800b14:	f6 c2 03             	test   $0x3,%dl
  800b17:	75 0a                	jne    800b23 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800b19:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800b1c:	89 c7                	mov    %eax,%edi
  800b1e:	fc                   	cld    
  800b1f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b21:	eb 05                	jmp    800b28 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800b23:	89 c7                	mov    %eax,%edi
  800b25:	fc                   	cld    
  800b26:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800b28:	5e                   	pop    %esi
  800b29:	5f                   	pop    %edi
  800b2a:	5d                   	pop    %ebp
  800b2b:	c3                   	ret    

00800b2c <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800b2c:	f3 0f 1e fb          	endbr32 
  800b30:	55                   	push   %ebp
  800b31:	89 e5                	mov    %esp,%ebp
  800b33:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800b36:	ff 75 10             	pushl  0x10(%ebp)
  800b39:	ff 75 0c             	pushl  0xc(%ebp)
  800b3c:	ff 75 08             	pushl  0x8(%ebp)
  800b3f:	e8 82 ff ff ff       	call   800ac6 <memmove>
}
  800b44:	c9                   	leave  
  800b45:	c3                   	ret    

00800b46 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800b46:	f3 0f 1e fb          	endbr32 
  800b4a:	55                   	push   %ebp
  800b4b:	89 e5                	mov    %esp,%ebp
  800b4d:	56                   	push   %esi
  800b4e:	53                   	push   %ebx
  800b4f:	8b 45 08             	mov    0x8(%ebp),%eax
  800b52:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b55:	89 c6                	mov    %eax,%esi
  800b57:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800b5a:	39 f0                	cmp    %esi,%eax
  800b5c:	74 1c                	je     800b7a <memcmp+0x34>
		if (*s1 != *s2)
  800b5e:	0f b6 08             	movzbl (%eax),%ecx
  800b61:	0f b6 1a             	movzbl (%edx),%ebx
  800b64:	38 d9                	cmp    %bl,%cl
  800b66:	75 08                	jne    800b70 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800b68:	83 c0 01             	add    $0x1,%eax
  800b6b:	83 c2 01             	add    $0x1,%edx
  800b6e:	eb ea                	jmp    800b5a <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800b70:	0f b6 c1             	movzbl %cl,%eax
  800b73:	0f b6 db             	movzbl %bl,%ebx
  800b76:	29 d8                	sub    %ebx,%eax
  800b78:	eb 05                	jmp    800b7f <memcmp+0x39>
	}

	return 0;
  800b7a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b7f:	5b                   	pop    %ebx
  800b80:	5e                   	pop    %esi
  800b81:	5d                   	pop    %ebp
  800b82:	c3                   	ret    

00800b83 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b83:	f3 0f 1e fb          	endbr32 
  800b87:	55                   	push   %ebp
  800b88:	89 e5                	mov    %esp,%ebp
  800b8a:	8b 45 08             	mov    0x8(%ebp),%eax
  800b8d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800b90:	89 c2                	mov    %eax,%edx
  800b92:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800b95:	39 d0                	cmp    %edx,%eax
  800b97:	73 09                	jae    800ba2 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800b99:	38 08                	cmp    %cl,(%eax)
  800b9b:	74 05                	je     800ba2 <memfind+0x1f>
	for (; s < ends; s++)
  800b9d:	83 c0 01             	add    $0x1,%eax
  800ba0:	eb f3                	jmp    800b95 <memfind+0x12>
			break;
	return (void *) s;
}
  800ba2:	5d                   	pop    %ebp
  800ba3:	c3                   	ret    

00800ba4 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800ba4:	f3 0f 1e fb          	endbr32 
  800ba8:	55                   	push   %ebp
  800ba9:	89 e5                	mov    %esp,%ebp
  800bab:	57                   	push   %edi
  800bac:	56                   	push   %esi
  800bad:	53                   	push   %ebx
  800bae:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800bb1:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800bb4:	eb 03                	jmp    800bb9 <strtol+0x15>
		s++;
  800bb6:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800bb9:	0f b6 01             	movzbl (%ecx),%eax
  800bbc:	3c 20                	cmp    $0x20,%al
  800bbe:	74 f6                	je     800bb6 <strtol+0x12>
  800bc0:	3c 09                	cmp    $0x9,%al
  800bc2:	74 f2                	je     800bb6 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800bc4:	3c 2b                	cmp    $0x2b,%al
  800bc6:	74 2a                	je     800bf2 <strtol+0x4e>
	int neg = 0;
  800bc8:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800bcd:	3c 2d                	cmp    $0x2d,%al
  800bcf:	74 2b                	je     800bfc <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bd1:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800bd7:	75 0f                	jne    800be8 <strtol+0x44>
  800bd9:	80 39 30             	cmpb   $0x30,(%ecx)
  800bdc:	74 28                	je     800c06 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800bde:	85 db                	test   %ebx,%ebx
  800be0:	b8 0a 00 00 00       	mov    $0xa,%eax
  800be5:	0f 44 d8             	cmove  %eax,%ebx
  800be8:	b8 00 00 00 00       	mov    $0x0,%eax
  800bed:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800bf0:	eb 46                	jmp    800c38 <strtol+0x94>
		s++;
  800bf2:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800bf5:	bf 00 00 00 00       	mov    $0x0,%edi
  800bfa:	eb d5                	jmp    800bd1 <strtol+0x2d>
		s++, neg = 1;
  800bfc:	83 c1 01             	add    $0x1,%ecx
  800bff:	bf 01 00 00 00       	mov    $0x1,%edi
  800c04:	eb cb                	jmp    800bd1 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800c06:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800c0a:	74 0e                	je     800c1a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800c0c:	85 db                	test   %ebx,%ebx
  800c0e:	75 d8                	jne    800be8 <strtol+0x44>
		s++, base = 8;
  800c10:	83 c1 01             	add    $0x1,%ecx
  800c13:	bb 08 00 00 00       	mov    $0x8,%ebx
  800c18:	eb ce                	jmp    800be8 <strtol+0x44>
		s += 2, base = 16;
  800c1a:	83 c1 02             	add    $0x2,%ecx
  800c1d:	bb 10 00 00 00       	mov    $0x10,%ebx
  800c22:	eb c4                	jmp    800be8 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800c24:	0f be d2             	movsbl %dl,%edx
  800c27:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800c2a:	3b 55 10             	cmp    0x10(%ebp),%edx
  800c2d:	7d 3a                	jge    800c69 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800c2f:	83 c1 01             	add    $0x1,%ecx
  800c32:	0f af 45 10          	imul   0x10(%ebp),%eax
  800c36:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800c38:	0f b6 11             	movzbl (%ecx),%edx
  800c3b:	8d 72 d0             	lea    -0x30(%edx),%esi
  800c3e:	89 f3                	mov    %esi,%ebx
  800c40:	80 fb 09             	cmp    $0x9,%bl
  800c43:	76 df                	jbe    800c24 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800c45:	8d 72 9f             	lea    -0x61(%edx),%esi
  800c48:	89 f3                	mov    %esi,%ebx
  800c4a:	80 fb 19             	cmp    $0x19,%bl
  800c4d:	77 08                	ja     800c57 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800c4f:	0f be d2             	movsbl %dl,%edx
  800c52:	83 ea 57             	sub    $0x57,%edx
  800c55:	eb d3                	jmp    800c2a <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800c57:	8d 72 bf             	lea    -0x41(%edx),%esi
  800c5a:	89 f3                	mov    %esi,%ebx
  800c5c:	80 fb 19             	cmp    $0x19,%bl
  800c5f:	77 08                	ja     800c69 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800c61:	0f be d2             	movsbl %dl,%edx
  800c64:	83 ea 37             	sub    $0x37,%edx
  800c67:	eb c1                	jmp    800c2a <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800c69:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800c6d:	74 05                	je     800c74 <strtol+0xd0>
		*endptr = (char *) s;
  800c6f:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c72:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800c74:	89 c2                	mov    %eax,%edx
  800c76:	f7 da                	neg    %edx
  800c78:	85 ff                	test   %edi,%edi
  800c7a:	0f 45 c2             	cmovne %edx,%eax
}
  800c7d:	5b                   	pop    %ebx
  800c7e:	5e                   	pop    %esi
  800c7f:	5f                   	pop    %edi
  800c80:	5d                   	pop    %ebp
  800c81:	c3                   	ret    

00800c82 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c82:	f3 0f 1e fb          	endbr32 
  800c86:	55                   	push   %ebp
  800c87:	89 e5                	mov    %esp,%ebp
  800c89:	57                   	push   %edi
  800c8a:	56                   	push   %esi
  800c8b:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c8c:	b8 00 00 00 00       	mov    $0x0,%eax
  800c91:	8b 55 08             	mov    0x8(%ebp),%edx
  800c94:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c97:	89 c3                	mov    %eax,%ebx
  800c99:	89 c7                	mov    %eax,%edi
  800c9b:	89 c6                	mov    %eax,%esi
  800c9d:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c9f:	5b                   	pop    %ebx
  800ca0:	5e                   	pop    %esi
  800ca1:	5f                   	pop    %edi
  800ca2:	5d                   	pop    %ebp
  800ca3:	c3                   	ret    

00800ca4 <sys_cgetc>:

int
sys_cgetc(void)
{
  800ca4:	f3 0f 1e fb          	endbr32 
  800ca8:	55                   	push   %ebp
  800ca9:	89 e5                	mov    %esp,%ebp
  800cab:	57                   	push   %edi
  800cac:	56                   	push   %esi
  800cad:	53                   	push   %ebx
	asm volatile("int %1\n"
  800cae:	ba 00 00 00 00       	mov    $0x0,%edx
  800cb3:	b8 01 00 00 00       	mov    $0x1,%eax
  800cb8:	89 d1                	mov    %edx,%ecx
  800cba:	89 d3                	mov    %edx,%ebx
  800cbc:	89 d7                	mov    %edx,%edi
  800cbe:	89 d6                	mov    %edx,%esi
  800cc0:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800cc2:	5b                   	pop    %ebx
  800cc3:	5e                   	pop    %esi
  800cc4:	5f                   	pop    %edi
  800cc5:	5d                   	pop    %ebp
  800cc6:	c3                   	ret    

00800cc7 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800cc7:	f3 0f 1e fb          	endbr32 
  800ccb:	55                   	push   %ebp
  800ccc:	89 e5                	mov    %esp,%ebp
  800cce:	57                   	push   %edi
  800ccf:	56                   	push   %esi
  800cd0:	53                   	push   %ebx
  800cd1:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cd4:	b9 00 00 00 00       	mov    $0x0,%ecx
  800cd9:	8b 55 08             	mov    0x8(%ebp),%edx
  800cdc:	b8 03 00 00 00       	mov    $0x3,%eax
  800ce1:	89 cb                	mov    %ecx,%ebx
  800ce3:	89 cf                	mov    %ecx,%edi
  800ce5:	89 ce                	mov    %ecx,%esi
  800ce7:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ce9:	85 c0                	test   %eax,%eax
  800ceb:	7f 08                	jg     800cf5 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800ced:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800cf0:	5b                   	pop    %ebx
  800cf1:	5e                   	pop    %esi
  800cf2:	5f                   	pop    %edi
  800cf3:	5d                   	pop    %ebp
  800cf4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800cf5:	83 ec 0c             	sub    $0xc,%esp
  800cf8:	50                   	push   %eax
  800cf9:	6a 03                	push   $0x3
  800cfb:	68 1f 24 80 00       	push   $0x80241f
  800d00:	6a 23                	push   $0x23
  800d02:	68 3c 24 80 00       	push   $0x80243c
  800d07:	e8 44 f5 ff ff       	call   800250 <_panic>

00800d0c <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800d0c:	f3 0f 1e fb          	endbr32 
  800d10:	55                   	push   %ebp
  800d11:	89 e5                	mov    %esp,%ebp
  800d13:	57                   	push   %edi
  800d14:	56                   	push   %esi
  800d15:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d16:	ba 00 00 00 00       	mov    $0x0,%edx
  800d1b:	b8 02 00 00 00       	mov    $0x2,%eax
  800d20:	89 d1                	mov    %edx,%ecx
  800d22:	89 d3                	mov    %edx,%ebx
  800d24:	89 d7                	mov    %edx,%edi
  800d26:	89 d6                	mov    %edx,%esi
  800d28:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800d2a:	5b                   	pop    %ebx
  800d2b:	5e                   	pop    %esi
  800d2c:	5f                   	pop    %edi
  800d2d:	5d                   	pop    %ebp
  800d2e:	c3                   	ret    

00800d2f <sys_yield>:

void
sys_yield(void)
{
  800d2f:	f3 0f 1e fb          	endbr32 
  800d33:	55                   	push   %ebp
  800d34:	89 e5                	mov    %esp,%ebp
  800d36:	57                   	push   %edi
  800d37:	56                   	push   %esi
  800d38:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d39:	ba 00 00 00 00       	mov    $0x0,%edx
  800d3e:	b8 0b 00 00 00       	mov    $0xb,%eax
  800d43:	89 d1                	mov    %edx,%ecx
  800d45:	89 d3                	mov    %edx,%ebx
  800d47:	89 d7                	mov    %edx,%edi
  800d49:	89 d6                	mov    %edx,%esi
  800d4b:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800d4d:	5b                   	pop    %ebx
  800d4e:	5e                   	pop    %esi
  800d4f:	5f                   	pop    %edi
  800d50:	5d                   	pop    %ebp
  800d51:	c3                   	ret    

00800d52 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800d52:	f3 0f 1e fb          	endbr32 
  800d56:	55                   	push   %ebp
  800d57:	89 e5                	mov    %esp,%ebp
  800d59:	57                   	push   %edi
  800d5a:	56                   	push   %esi
  800d5b:	53                   	push   %ebx
  800d5c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d5f:	be 00 00 00 00       	mov    $0x0,%esi
  800d64:	8b 55 08             	mov    0x8(%ebp),%edx
  800d67:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d6a:	b8 04 00 00 00       	mov    $0x4,%eax
  800d6f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d72:	89 f7                	mov    %esi,%edi
  800d74:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d76:	85 c0                	test   %eax,%eax
  800d78:	7f 08                	jg     800d82 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800d7a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d7d:	5b                   	pop    %ebx
  800d7e:	5e                   	pop    %esi
  800d7f:	5f                   	pop    %edi
  800d80:	5d                   	pop    %ebp
  800d81:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d82:	83 ec 0c             	sub    $0xc,%esp
  800d85:	50                   	push   %eax
  800d86:	6a 04                	push   $0x4
  800d88:	68 1f 24 80 00       	push   $0x80241f
  800d8d:	6a 23                	push   $0x23
  800d8f:	68 3c 24 80 00       	push   $0x80243c
  800d94:	e8 b7 f4 ff ff       	call   800250 <_panic>

00800d99 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800d99:	f3 0f 1e fb          	endbr32 
  800d9d:	55                   	push   %ebp
  800d9e:	89 e5                	mov    %esp,%ebp
  800da0:	57                   	push   %edi
  800da1:	56                   	push   %esi
  800da2:	53                   	push   %ebx
  800da3:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800da6:	8b 55 08             	mov    0x8(%ebp),%edx
  800da9:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dac:	b8 05 00 00 00       	mov    $0x5,%eax
  800db1:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800db4:	8b 7d 14             	mov    0x14(%ebp),%edi
  800db7:	8b 75 18             	mov    0x18(%ebp),%esi
  800dba:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dbc:	85 c0                	test   %eax,%eax
  800dbe:	7f 08                	jg     800dc8 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800dc0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dc3:	5b                   	pop    %ebx
  800dc4:	5e                   	pop    %esi
  800dc5:	5f                   	pop    %edi
  800dc6:	5d                   	pop    %ebp
  800dc7:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dc8:	83 ec 0c             	sub    $0xc,%esp
  800dcb:	50                   	push   %eax
  800dcc:	6a 05                	push   $0x5
  800dce:	68 1f 24 80 00       	push   $0x80241f
  800dd3:	6a 23                	push   $0x23
  800dd5:	68 3c 24 80 00       	push   $0x80243c
  800dda:	e8 71 f4 ff ff       	call   800250 <_panic>

00800ddf <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800ddf:	f3 0f 1e fb          	endbr32 
  800de3:	55                   	push   %ebp
  800de4:	89 e5                	mov    %esp,%ebp
  800de6:	57                   	push   %edi
  800de7:	56                   	push   %esi
  800de8:	53                   	push   %ebx
  800de9:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dec:	bb 00 00 00 00       	mov    $0x0,%ebx
  800df1:	8b 55 08             	mov    0x8(%ebp),%edx
  800df4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800df7:	b8 06 00 00 00       	mov    $0x6,%eax
  800dfc:	89 df                	mov    %ebx,%edi
  800dfe:	89 de                	mov    %ebx,%esi
  800e00:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e02:	85 c0                	test   %eax,%eax
  800e04:	7f 08                	jg     800e0e <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800e06:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e09:	5b                   	pop    %ebx
  800e0a:	5e                   	pop    %esi
  800e0b:	5f                   	pop    %edi
  800e0c:	5d                   	pop    %ebp
  800e0d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e0e:	83 ec 0c             	sub    $0xc,%esp
  800e11:	50                   	push   %eax
  800e12:	6a 06                	push   $0x6
  800e14:	68 1f 24 80 00       	push   $0x80241f
  800e19:	6a 23                	push   $0x23
  800e1b:	68 3c 24 80 00       	push   $0x80243c
  800e20:	e8 2b f4 ff ff       	call   800250 <_panic>

00800e25 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800e25:	f3 0f 1e fb          	endbr32 
  800e29:	55                   	push   %ebp
  800e2a:	89 e5                	mov    %esp,%ebp
  800e2c:	57                   	push   %edi
  800e2d:	56                   	push   %esi
  800e2e:	53                   	push   %ebx
  800e2f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e32:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e37:	8b 55 08             	mov    0x8(%ebp),%edx
  800e3a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e3d:	b8 08 00 00 00       	mov    $0x8,%eax
  800e42:	89 df                	mov    %ebx,%edi
  800e44:	89 de                	mov    %ebx,%esi
  800e46:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e48:	85 c0                	test   %eax,%eax
  800e4a:	7f 08                	jg     800e54 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800e4c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e4f:	5b                   	pop    %ebx
  800e50:	5e                   	pop    %esi
  800e51:	5f                   	pop    %edi
  800e52:	5d                   	pop    %ebp
  800e53:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e54:	83 ec 0c             	sub    $0xc,%esp
  800e57:	50                   	push   %eax
  800e58:	6a 08                	push   $0x8
  800e5a:	68 1f 24 80 00       	push   $0x80241f
  800e5f:	6a 23                	push   $0x23
  800e61:	68 3c 24 80 00       	push   $0x80243c
  800e66:	e8 e5 f3 ff ff       	call   800250 <_panic>

00800e6b <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800e6b:	f3 0f 1e fb          	endbr32 
  800e6f:	55                   	push   %ebp
  800e70:	89 e5                	mov    %esp,%ebp
  800e72:	57                   	push   %edi
  800e73:	56                   	push   %esi
  800e74:	53                   	push   %ebx
  800e75:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e78:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e7d:	8b 55 08             	mov    0x8(%ebp),%edx
  800e80:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e83:	b8 09 00 00 00       	mov    $0x9,%eax
  800e88:	89 df                	mov    %ebx,%edi
  800e8a:	89 de                	mov    %ebx,%esi
  800e8c:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e8e:	85 c0                	test   %eax,%eax
  800e90:	7f 08                	jg     800e9a <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e92:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e95:	5b                   	pop    %ebx
  800e96:	5e                   	pop    %esi
  800e97:	5f                   	pop    %edi
  800e98:	5d                   	pop    %ebp
  800e99:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e9a:	83 ec 0c             	sub    $0xc,%esp
  800e9d:	50                   	push   %eax
  800e9e:	6a 09                	push   $0x9
  800ea0:	68 1f 24 80 00       	push   $0x80241f
  800ea5:	6a 23                	push   $0x23
  800ea7:	68 3c 24 80 00       	push   $0x80243c
  800eac:	e8 9f f3 ff ff       	call   800250 <_panic>

00800eb1 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800eb1:	f3 0f 1e fb          	endbr32 
  800eb5:	55                   	push   %ebp
  800eb6:	89 e5                	mov    %esp,%ebp
  800eb8:	57                   	push   %edi
  800eb9:	56                   	push   %esi
  800eba:	53                   	push   %ebx
  800ebb:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800ebe:	bb 00 00 00 00       	mov    $0x0,%ebx
  800ec3:	8b 55 08             	mov    0x8(%ebp),%edx
  800ec6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ec9:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ece:	89 df                	mov    %ebx,%edi
  800ed0:	89 de                	mov    %ebx,%esi
  800ed2:	cd 30                	int    $0x30
	if(check && ret > 0)
  800ed4:	85 c0                	test   %eax,%eax
  800ed6:	7f 08                	jg     800ee0 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800ed8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800edb:	5b                   	pop    %ebx
  800edc:	5e                   	pop    %esi
  800edd:	5f                   	pop    %edi
  800ede:	5d                   	pop    %ebp
  800edf:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ee0:	83 ec 0c             	sub    $0xc,%esp
  800ee3:	50                   	push   %eax
  800ee4:	6a 0a                	push   $0xa
  800ee6:	68 1f 24 80 00       	push   $0x80241f
  800eeb:	6a 23                	push   $0x23
  800eed:	68 3c 24 80 00       	push   $0x80243c
  800ef2:	e8 59 f3 ff ff       	call   800250 <_panic>

00800ef7 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800ef7:	f3 0f 1e fb          	endbr32 
  800efb:	55                   	push   %ebp
  800efc:	89 e5                	mov    %esp,%ebp
  800efe:	57                   	push   %edi
  800eff:	56                   	push   %esi
  800f00:	53                   	push   %ebx
	asm volatile("int %1\n"
  800f01:	8b 55 08             	mov    0x8(%ebp),%edx
  800f04:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f07:	b8 0c 00 00 00       	mov    $0xc,%eax
  800f0c:	be 00 00 00 00       	mov    $0x0,%esi
  800f11:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f14:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f17:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800f19:	5b                   	pop    %ebx
  800f1a:	5e                   	pop    %esi
  800f1b:	5f                   	pop    %edi
  800f1c:	5d                   	pop    %ebp
  800f1d:	c3                   	ret    

00800f1e <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800f1e:	f3 0f 1e fb          	endbr32 
  800f22:	55                   	push   %ebp
  800f23:	89 e5                	mov    %esp,%ebp
  800f25:	57                   	push   %edi
  800f26:	56                   	push   %esi
  800f27:	53                   	push   %ebx
  800f28:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f2b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800f30:	8b 55 08             	mov    0x8(%ebp),%edx
  800f33:	b8 0d 00 00 00       	mov    $0xd,%eax
  800f38:	89 cb                	mov    %ecx,%ebx
  800f3a:	89 cf                	mov    %ecx,%edi
  800f3c:	89 ce                	mov    %ecx,%esi
  800f3e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f40:	85 c0                	test   %eax,%eax
  800f42:	7f 08                	jg     800f4c <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800f44:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f47:	5b                   	pop    %ebx
  800f48:	5e                   	pop    %esi
  800f49:	5f                   	pop    %edi
  800f4a:	5d                   	pop    %ebp
  800f4b:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f4c:	83 ec 0c             	sub    $0xc,%esp
  800f4f:	50                   	push   %eax
  800f50:	6a 0d                	push   $0xd
  800f52:	68 1f 24 80 00       	push   $0x80241f
  800f57:	6a 23                	push   $0x23
  800f59:	68 3c 24 80 00       	push   $0x80243c
  800f5e:	e8 ed f2 ff ff       	call   800250 <_panic>

00800f63 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  800f63:	f3 0f 1e fb          	endbr32 
  800f67:	55                   	push   %ebp
  800f68:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800f6a:	8b 45 08             	mov    0x8(%ebp),%eax
  800f6d:	05 00 00 00 30       	add    $0x30000000,%eax
  800f72:	c1 e8 0c             	shr    $0xc,%eax
}
  800f75:	5d                   	pop    %ebp
  800f76:	c3                   	ret    

00800f77 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  800f77:	f3 0f 1e fb          	endbr32 
  800f7b:	55                   	push   %ebp
  800f7c:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  800f7e:	8b 45 08             	mov    0x8(%ebp),%eax
  800f81:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  800f86:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  800f8b:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  800f90:	5d                   	pop    %ebp
  800f91:	c3                   	ret    

00800f92 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  800f92:	f3 0f 1e fb          	endbr32 
  800f96:	55                   	push   %ebp
  800f97:	89 e5                	mov    %esp,%ebp
  800f99:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  800f9e:	89 c2                	mov    %eax,%edx
  800fa0:	c1 ea 16             	shr    $0x16,%edx
  800fa3:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  800faa:	f6 c2 01             	test   $0x1,%dl
  800fad:	74 2d                	je     800fdc <fd_alloc+0x4a>
  800faf:	89 c2                	mov    %eax,%edx
  800fb1:	c1 ea 0c             	shr    $0xc,%edx
  800fb4:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  800fbb:	f6 c2 01             	test   $0x1,%dl
  800fbe:	74 1c                	je     800fdc <fd_alloc+0x4a>
  800fc0:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  800fc5:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  800fca:	75 d2                	jne    800f9e <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  800fcc:	8b 45 08             	mov    0x8(%ebp),%eax
  800fcf:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  800fd5:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  800fda:	eb 0a                	jmp    800fe6 <fd_alloc+0x54>
			*fd_store = fd;
  800fdc:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800fdf:	89 01                	mov    %eax,(%ecx)
			return 0;
  800fe1:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800fe6:	5d                   	pop    %ebp
  800fe7:	c3                   	ret    

00800fe8 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  800fe8:	f3 0f 1e fb          	endbr32 
  800fec:	55                   	push   %ebp
  800fed:	89 e5                	mov    %esp,%ebp
  800fef:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  800ff2:	83 f8 1f             	cmp    $0x1f,%eax
  800ff5:	77 30                	ja     801027 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  800ff7:	c1 e0 0c             	shl    $0xc,%eax
  800ffa:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  800fff:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  801005:	f6 c2 01             	test   $0x1,%dl
  801008:	74 24                	je     80102e <fd_lookup+0x46>
  80100a:	89 c2                	mov    %eax,%edx
  80100c:	c1 ea 0c             	shr    $0xc,%edx
  80100f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801016:	f6 c2 01             	test   $0x1,%dl
  801019:	74 1a                	je     801035 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  80101b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80101e:	89 02                	mov    %eax,(%edx)
	return 0;
  801020:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801025:	5d                   	pop    %ebp
  801026:	c3                   	ret    
		return -E_INVAL;
  801027:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80102c:	eb f7                	jmp    801025 <fd_lookup+0x3d>
		return -E_INVAL;
  80102e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801033:	eb f0                	jmp    801025 <fd_lookup+0x3d>
  801035:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80103a:	eb e9                	jmp    801025 <fd_lookup+0x3d>

0080103c <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  80103c:	f3 0f 1e fb          	endbr32 
  801040:	55                   	push   %ebp
  801041:	89 e5                	mov    %esp,%ebp
  801043:	83 ec 08             	sub    $0x8,%esp
  801046:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801049:	ba c8 24 80 00       	mov    $0x8024c8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  80104e:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  801053:	39 08                	cmp    %ecx,(%eax)
  801055:	74 33                	je     80108a <dev_lookup+0x4e>
  801057:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  80105a:	8b 02                	mov    (%edx),%eax
  80105c:	85 c0                	test   %eax,%eax
  80105e:	75 f3                	jne    801053 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801060:	a1 04 40 80 00       	mov    0x804004,%eax
  801065:	8b 40 48             	mov    0x48(%eax),%eax
  801068:	83 ec 04             	sub    $0x4,%esp
  80106b:	51                   	push   %ecx
  80106c:	50                   	push   %eax
  80106d:	68 4c 24 80 00       	push   $0x80244c
  801072:	e8 c0 f2 ff ff       	call   800337 <cprintf>
	*dev = 0;
  801077:	8b 45 0c             	mov    0xc(%ebp),%eax
  80107a:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801080:	83 c4 10             	add    $0x10,%esp
  801083:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801088:	c9                   	leave  
  801089:	c3                   	ret    
			*dev = devtab[i];
  80108a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80108d:	89 01                	mov    %eax,(%ecx)
			return 0;
  80108f:	b8 00 00 00 00       	mov    $0x0,%eax
  801094:	eb f2                	jmp    801088 <dev_lookup+0x4c>

00801096 <fd_close>:
{
  801096:	f3 0f 1e fb          	endbr32 
  80109a:	55                   	push   %ebp
  80109b:	89 e5                	mov    %esp,%ebp
  80109d:	57                   	push   %edi
  80109e:	56                   	push   %esi
  80109f:	53                   	push   %ebx
  8010a0:	83 ec 24             	sub    $0x24,%esp
  8010a3:	8b 75 08             	mov    0x8(%ebp),%esi
  8010a6:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8010a9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8010ac:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8010ad:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8010b3:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8010b6:	50                   	push   %eax
  8010b7:	e8 2c ff ff ff       	call   800fe8 <fd_lookup>
  8010bc:	89 c3                	mov    %eax,%ebx
  8010be:	83 c4 10             	add    $0x10,%esp
  8010c1:	85 c0                	test   %eax,%eax
  8010c3:	78 05                	js     8010ca <fd_close+0x34>
	    || fd != fd2)
  8010c5:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8010c8:	74 16                	je     8010e0 <fd_close+0x4a>
		return (must_exist ? r : 0);
  8010ca:	89 f8                	mov    %edi,%eax
  8010cc:	84 c0                	test   %al,%al
  8010ce:	b8 00 00 00 00       	mov    $0x0,%eax
  8010d3:	0f 44 d8             	cmove  %eax,%ebx
}
  8010d6:	89 d8                	mov    %ebx,%eax
  8010d8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8010db:	5b                   	pop    %ebx
  8010dc:	5e                   	pop    %esi
  8010dd:	5f                   	pop    %edi
  8010de:	5d                   	pop    %ebp
  8010df:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8010e0:	83 ec 08             	sub    $0x8,%esp
  8010e3:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8010e6:	50                   	push   %eax
  8010e7:	ff 36                	pushl  (%esi)
  8010e9:	e8 4e ff ff ff       	call   80103c <dev_lookup>
  8010ee:	89 c3                	mov    %eax,%ebx
  8010f0:	83 c4 10             	add    $0x10,%esp
  8010f3:	85 c0                	test   %eax,%eax
  8010f5:	78 1a                	js     801111 <fd_close+0x7b>
		if (dev->dev_close)
  8010f7:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8010fa:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8010fd:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801102:	85 c0                	test   %eax,%eax
  801104:	74 0b                	je     801111 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  801106:	83 ec 0c             	sub    $0xc,%esp
  801109:	56                   	push   %esi
  80110a:	ff d0                	call   *%eax
  80110c:	89 c3                	mov    %eax,%ebx
  80110e:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801111:	83 ec 08             	sub    $0x8,%esp
  801114:	56                   	push   %esi
  801115:	6a 00                	push   $0x0
  801117:	e8 c3 fc ff ff       	call   800ddf <sys_page_unmap>
	return r;
  80111c:	83 c4 10             	add    $0x10,%esp
  80111f:	eb b5                	jmp    8010d6 <fd_close+0x40>

00801121 <close>:

int
close(int fdnum)
{
  801121:	f3 0f 1e fb          	endbr32 
  801125:	55                   	push   %ebp
  801126:	89 e5                	mov    %esp,%ebp
  801128:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80112b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80112e:	50                   	push   %eax
  80112f:	ff 75 08             	pushl  0x8(%ebp)
  801132:	e8 b1 fe ff ff       	call   800fe8 <fd_lookup>
  801137:	83 c4 10             	add    $0x10,%esp
  80113a:	85 c0                	test   %eax,%eax
  80113c:	79 02                	jns    801140 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  80113e:	c9                   	leave  
  80113f:	c3                   	ret    
		return fd_close(fd, 1);
  801140:	83 ec 08             	sub    $0x8,%esp
  801143:	6a 01                	push   $0x1
  801145:	ff 75 f4             	pushl  -0xc(%ebp)
  801148:	e8 49 ff ff ff       	call   801096 <fd_close>
  80114d:	83 c4 10             	add    $0x10,%esp
  801150:	eb ec                	jmp    80113e <close+0x1d>

00801152 <close_all>:

void
close_all(void)
{
  801152:	f3 0f 1e fb          	endbr32 
  801156:	55                   	push   %ebp
  801157:	89 e5                	mov    %esp,%ebp
  801159:	53                   	push   %ebx
  80115a:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  80115d:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801162:	83 ec 0c             	sub    $0xc,%esp
  801165:	53                   	push   %ebx
  801166:	e8 b6 ff ff ff       	call   801121 <close>
	for (i = 0; i < MAXFD; i++)
  80116b:	83 c3 01             	add    $0x1,%ebx
  80116e:	83 c4 10             	add    $0x10,%esp
  801171:	83 fb 20             	cmp    $0x20,%ebx
  801174:	75 ec                	jne    801162 <close_all+0x10>
}
  801176:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801179:	c9                   	leave  
  80117a:	c3                   	ret    

0080117b <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80117b:	f3 0f 1e fb          	endbr32 
  80117f:	55                   	push   %ebp
  801180:	89 e5                	mov    %esp,%ebp
  801182:	57                   	push   %edi
  801183:	56                   	push   %esi
  801184:	53                   	push   %ebx
  801185:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801188:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80118b:	50                   	push   %eax
  80118c:	ff 75 08             	pushl  0x8(%ebp)
  80118f:	e8 54 fe ff ff       	call   800fe8 <fd_lookup>
  801194:	89 c3                	mov    %eax,%ebx
  801196:	83 c4 10             	add    $0x10,%esp
  801199:	85 c0                	test   %eax,%eax
  80119b:	0f 88 81 00 00 00    	js     801222 <dup+0xa7>
		return r;
	close(newfdnum);
  8011a1:	83 ec 0c             	sub    $0xc,%esp
  8011a4:	ff 75 0c             	pushl  0xc(%ebp)
  8011a7:	e8 75 ff ff ff       	call   801121 <close>

	newfd = INDEX2FD(newfdnum);
  8011ac:	8b 75 0c             	mov    0xc(%ebp),%esi
  8011af:	c1 e6 0c             	shl    $0xc,%esi
  8011b2:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8011b8:	83 c4 04             	add    $0x4,%esp
  8011bb:	ff 75 e4             	pushl  -0x1c(%ebp)
  8011be:	e8 b4 fd ff ff       	call   800f77 <fd2data>
  8011c3:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8011c5:	89 34 24             	mov    %esi,(%esp)
  8011c8:	e8 aa fd ff ff       	call   800f77 <fd2data>
  8011cd:	83 c4 10             	add    $0x10,%esp
  8011d0:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8011d2:	89 d8                	mov    %ebx,%eax
  8011d4:	c1 e8 16             	shr    $0x16,%eax
  8011d7:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8011de:	a8 01                	test   $0x1,%al
  8011e0:	74 11                	je     8011f3 <dup+0x78>
  8011e2:	89 d8                	mov    %ebx,%eax
  8011e4:	c1 e8 0c             	shr    $0xc,%eax
  8011e7:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8011ee:	f6 c2 01             	test   $0x1,%dl
  8011f1:	75 39                	jne    80122c <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8011f3:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8011f6:	89 d0                	mov    %edx,%eax
  8011f8:	c1 e8 0c             	shr    $0xc,%eax
  8011fb:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801202:	83 ec 0c             	sub    $0xc,%esp
  801205:	25 07 0e 00 00       	and    $0xe07,%eax
  80120a:	50                   	push   %eax
  80120b:	56                   	push   %esi
  80120c:	6a 00                	push   $0x0
  80120e:	52                   	push   %edx
  80120f:	6a 00                	push   $0x0
  801211:	e8 83 fb ff ff       	call   800d99 <sys_page_map>
  801216:	89 c3                	mov    %eax,%ebx
  801218:	83 c4 20             	add    $0x20,%esp
  80121b:	85 c0                	test   %eax,%eax
  80121d:	78 31                	js     801250 <dup+0xd5>
		goto err;

	return newfdnum;
  80121f:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801222:	89 d8                	mov    %ebx,%eax
  801224:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801227:	5b                   	pop    %ebx
  801228:	5e                   	pop    %esi
  801229:	5f                   	pop    %edi
  80122a:	5d                   	pop    %ebp
  80122b:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  80122c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801233:	83 ec 0c             	sub    $0xc,%esp
  801236:	25 07 0e 00 00       	and    $0xe07,%eax
  80123b:	50                   	push   %eax
  80123c:	57                   	push   %edi
  80123d:	6a 00                	push   $0x0
  80123f:	53                   	push   %ebx
  801240:	6a 00                	push   $0x0
  801242:	e8 52 fb ff ff       	call   800d99 <sys_page_map>
  801247:	89 c3                	mov    %eax,%ebx
  801249:	83 c4 20             	add    $0x20,%esp
  80124c:	85 c0                	test   %eax,%eax
  80124e:	79 a3                	jns    8011f3 <dup+0x78>
	sys_page_unmap(0, newfd);
  801250:	83 ec 08             	sub    $0x8,%esp
  801253:	56                   	push   %esi
  801254:	6a 00                	push   $0x0
  801256:	e8 84 fb ff ff       	call   800ddf <sys_page_unmap>
	sys_page_unmap(0, nva);
  80125b:	83 c4 08             	add    $0x8,%esp
  80125e:	57                   	push   %edi
  80125f:	6a 00                	push   $0x0
  801261:	e8 79 fb ff ff       	call   800ddf <sys_page_unmap>
	return r;
  801266:	83 c4 10             	add    $0x10,%esp
  801269:	eb b7                	jmp    801222 <dup+0xa7>

0080126b <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80126b:	f3 0f 1e fb          	endbr32 
  80126f:	55                   	push   %ebp
  801270:	89 e5                	mov    %esp,%ebp
  801272:	53                   	push   %ebx
  801273:	83 ec 1c             	sub    $0x1c,%esp
  801276:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801279:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80127c:	50                   	push   %eax
  80127d:	53                   	push   %ebx
  80127e:	e8 65 fd ff ff       	call   800fe8 <fd_lookup>
  801283:	83 c4 10             	add    $0x10,%esp
  801286:	85 c0                	test   %eax,%eax
  801288:	78 3f                	js     8012c9 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80128a:	83 ec 08             	sub    $0x8,%esp
  80128d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801290:	50                   	push   %eax
  801291:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801294:	ff 30                	pushl  (%eax)
  801296:	e8 a1 fd ff ff       	call   80103c <dev_lookup>
  80129b:	83 c4 10             	add    $0x10,%esp
  80129e:	85 c0                	test   %eax,%eax
  8012a0:	78 27                	js     8012c9 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8012a2:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8012a5:	8b 42 08             	mov    0x8(%edx),%eax
  8012a8:	83 e0 03             	and    $0x3,%eax
  8012ab:	83 f8 01             	cmp    $0x1,%eax
  8012ae:	74 1e                	je     8012ce <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8012b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8012b3:	8b 40 08             	mov    0x8(%eax),%eax
  8012b6:	85 c0                	test   %eax,%eax
  8012b8:	74 35                	je     8012ef <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8012ba:	83 ec 04             	sub    $0x4,%esp
  8012bd:	ff 75 10             	pushl  0x10(%ebp)
  8012c0:	ff 75 0c             	pushl  0xc(%ebp)
  8012c3:	52                   	push   %edx
  8012c4:	ff d0                	call   *%eax
  8012c6:	83 c4 10             	add    $0x10,%esp
}
  8012c9:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8012cc:	c9                   	leave  
  8012cd:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8012ce:	a1 04 40 80 00       	mov    0x804004,%eax
  8012d3:	8b 40 48             	mov    0x48(%eax),%eax
  8012d6:	83 ec 04             	sub    $0x4,%esp
  8012d9:	53                   	push   %ebx
  8012da:	50                   	push   %eax
  8012db:	68 8d 24 80 00       	push   $0x80248d
  8012e0:	e8 52 f0 ff ff       	call   800337 <cprintf>
		return -E_INVAL;
  8012e5:	83 c4 10             	add    $0x10,%esp
  8012e8:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8012ed:	eb da                	jmp    8012c9 <read+0x5e>
		return -E_NOT_SUPP;
  8012ef:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8012f4:	eb d3                	jmp    8012c9 <read+0x5e>

008012f6 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8012f6:	f3 0f 1e fb          	endbr32 
  8012fa:	55                   	push   %ebp
  8012fb:	89 e5                	mov    %esp,%ebp
  8012fd:	57                   	push   %edi
  8012fe:	56                   	push   %esi
  8012ff:	53                   	push   %ebx
  801300:	83 ec 0c             	sub    $0xc,%esp
  801303:	8b 7d 08             	mov    0x8(%ebp),%edi
  801306:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801309:	bb 00 00 00 00       	mov    $0x0,%ebx
  80130e:	eb 02                	jmp    801312 <readn+0x1c>
  801310:	01 c3                	add    %eax,%ebx
  801312:	39 f3                	cmp    %esi,%ebx
  801314:	73 21                	jae    801337 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801316:	83 ec 04             	sub    $0x4,%esp
  801319:	89 f0                	mov    %esi,%eax
  80131b:	29 d8                	sub    %ebx,%eax
  80131d:	50                   	push   %eax
  80131e:	89 d8                	mov    %ebx,%eax
  801320:	03 45 0c             	add    0xc(%ebp),%eax
  801323:	50                   	push   %eax
  801324:	57                   	push   %edi
  801325:	e8 41 ff ff ff       	call   80126b <read>
		if (m < 0)
  80132a:	83 c4 10             	add    $0x10,%esp
  80132d:	85 c0                	test   %eax,%eax
  80132f:	78 04                	js     801335 <readn+0x3f>
			return m;
		if (m == 0)
  801331:	75 dd                	jne    801310 <readn+0x1a>
  801333:	eb 02                	jmp    801337 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801335:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801337:	89 d8                	mov    %ebx,%eax
  801339:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80133c:	5b                   	pop    %ebx
  80133d:	5e                   	pop    %esi
  80133e:	5f                   	pop    %edi
  80133f:	5d                   	pop    %ebp
  801340:	c3                   	ret    

00801341 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801341:	f3 0f 1e fb          	endbr32 
  801345:	55                   	push   %ebp
  801346:	89 e5                	mov    %esp,%ebp
  801348:	53                   	push   %ebx
  801349:	83 ec 1c             	sub    $0x1c,%esp
  80134c:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80134f:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801352:	50                   	push   %eax
  801353:	53                   	push   %ebx
  801354:	e8 8f fc ff ff       	call   800fe8 <fd_lookup>
  801359:	83 c4 10             	add    $0x10,%esp
  80135c:	85 c0                	test   %eax,%eax
  80135e:	78 3a                	js     80139a <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801360:	83 ec 08             	sub    $0x8,%esp
  801363:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801366:	50                   	push   %eax
  801367:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80136a:	ff 30                	pushl  (%eax)
  80136c:	e8 cb fc ff ff       	call   80103c <dev_lookup>
  801371:	83 c4 10             	add    $0x10,%esp
  801374:	85 c0                	test   %eax,%eax
  801376:	78 22                	js     80139a <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801378:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80137b:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  80137f:	74 1e                	je     80139f <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801381:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801384:	8b 52 0c             	mov    0xc(%edx),%edx
  801387:	85 d2                	test   %edx,%edx
  801389:	74 35                	je     8013c0 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80138b:	83 ec 04             	sub    $0x4,%esp
  80138e:	ff 75 10             	pushl  0x10(%ebp)
  801391:	ff 75 0c             	pushl  0xc(%ebp)
  801394:	50                   	push   %eax
  801395:	ff d2                	call   *%edx
  801397:	83 c4 10             	add    $0x10,%esp
}
  80139a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80139d:	c9                   	leave  
  80139e:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  80139f:	a1 04 40 80 00       	mov    0x804004,%eax
  8013a4:	8b 40 48             	mov    0x48(%eax),%eax
  8013a7:	83 ec 04             	sub    $0x4,%esp
  8013aa:	53                   	push   %ebx
  8013ab:	50                   	push   %eax
  8013ac:	68 a9 24 80 00       	push   $0x8024a9
  8013b1:	e8 81 ef ff ff       	call   800337 <cprintf>
		return -E_INVAL;
  8013b6:	83 c4 10             	add    $0x10,%esp
  8013b9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8013be:	eb da                	jmp    80139a <write+0x59>
		return -E_NOT_SUPP;
  8013c0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8013c5:	eb d3                	jmp    80139a <write+0x59>

008013c7 <seek>:

int
seek(int fdnum, off_t offset)
{
  8013c7:	f3 0f 1e fb          	endbr32 
  8013cb:	55                   	push   %ebp
  8013cc:	89 e5                	mov    %esp,%ebp
  8013ce:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8013d1:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8013d4:	50                   	push   %eax
  8013d5:	ff 75 08             	pushl  0x8(%ebp)
  8013d8:	e8 0b fc ff ff       	call   800fe8 <fd_lookup>
  8013dd:	83 c4 10             	add    $0x10,%esp
  8013e0:	85 c0                	test   %eax,%eax
  8013e2:	78 0e                	js     8013f2 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8013e4:	8b 55 0c             	mov    0xc(%ebp),%edx
  8013e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8013ea:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8013ed:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8013f2:	c9                   	leave  
  8013f3:	c3                   	ret    

008013f4 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8013f4:	f3 0f 1e fb          	endbr32 
  8013f8:	55                   	push   %ebp
  8013f9:	89 e5                	mov    %esp,%ebp
  8013fb:	53                   	push   %ebx
  8013fc:	83 ec 1c             	sub    $0x1c,%esp
  8013ff:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801402:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801405:	50                   	push   %eax
  801406:	53                   	push   %ebx
  801407:	e8 dc fb ff ff       	call   800fe8 <fd_lookup>
  80140c:	83 c4 10             	add    $0x10,%esp
  80140f:	85 c0                	test   %eax,%eax
  801411:	78 37                	js     80144a <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801413:	83 ec 08             	sub    $0x8,%esp
  801416:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801419:	50                   	push   %eax
  80141a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80141d:	ff 30                	pushl  (%eax)
  80141f:	e8 18 fc ff ff       	call   80103c <dev_lookup>
  801424:	83 c4 10             	add    $0x10,%esp
  801427:	85 c0                	test   %eax,%eax
  801429:	78 1f                	js     80144a <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80142b:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80142e:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801432:	74 1b                	je     80144f <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801434:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801437:	8b 52 18             	mov    0x18(%edx),%edx
  80143a:	85 d2                	test   %edx,%edx
  80143c:	74 32                	je     801470 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  80143e:	83 ec 08             	sub    $0x8,%esp
  801441:	ff 75 0c             	pushl  0xc(%ebp)
  801444:	50                   	push   %eax
  801445:	ff d2                	call   *%edx
  801447:	83 c4 10             	add    $0x10,%esp
}
  80144a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80144d:	c9                   	leave  
  80144e:	c3                   	ret    
			thisenv->env_id, fdnum);
  80144f:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801454:	8b 40 48             	mov    0x48(%eax),%eax
  801457:	83 ec 04             	sub    $0x4,%esp
  80145a:	53                   	push   %ebx
  80145b:	50                   	push   %eax
  80145c:	68 6c 24 80 00       	push   $0x80246c
  801461:	e8 d1 ee ff ff       	call   800337 <cprintf>
		return -E_INVAL;
  801466:	83 c4 10             	add    $0x10,%esp
  801469:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80146e:	eb da                	jmp    80144a <ftruncate+0x56>
		return -E_NOT_SUPP;
  801470:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801475:	eb d3                	jmp    80144a <ftruncate+0x56>

00801477 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801477:	f3 0f 1e fb          	endbr32 
  80147b:	55                   	push   %ebp
  80147c:	89 e5                	mov    %esp,%ebp
  80147e:	53                   	push   %ebx
  80147f:	83 ec 1c             	sub    $0x1c,%esp
  801482:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801485:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801488:	50                   	push   %eax
  801489:	ff 75 08             	pushl  0x8(%ebp)
  80148c:	e8 57 fb ff ff       	call   800fe8 <fd_lookup>
  801491:	83 c4 10             	add    $0x10,%esp
  801494:	85 c0                	test   %eax,%eax
  801496:	78 4b                	js     8014e3 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801498:	83 ec 08             	sub    $0x8,%esp
  80149b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80149e:	50                   	push   %eax
  80149f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8014a2:	ff 30                	pushl  (%eax)
  8014a4:	e8 93 fb ff ff       	call   80103c <dev_lookup>
  8014a9:	83 c4 10             	add    $0x10,%esp
  8014ac:	85 c0                	test   %eax,%eax
  8014ae:	78 33                	js     8014e3 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8014b0:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8014b3:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8014b7:	74 2f                	je     8014e8 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8014b9:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8014bc:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8014c3:	00 00 00 
	stat->st_isdir = 0;
  8014c6:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8014cd:	00 00 00 
	stat->st_dev = dev;
  8014d0:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8014d6:	83 ec 08             	sub    $0x8,%esp
  8014d9:	53                   	push   %ebx
  8014da:	ff 75 f0             	pushl  -0x10(%ebp)
  8014dd:	ff 50 14             	call   *0x14(%eax)
  8014e0:	83 c4 10             	add    $0x10,%esp
}
  8014e3:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014e6:	c9                   	leave  
  8014e7:	c3                   	ret    
		return -E_NOT_SUPP;
  8014e8:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8014ed:	eb f4                	jmp    8014e3 <fstat+0x6c>

008014ef <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8014ef:	f3 0f 1e fb          	endbr32 
  8014f3:	55                   	push   %ebp
  8014f4:	89 e5                	mov    %esp,%ebp
  8014f6:	56                   	push   %esi
  8014f7:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8014f8:	83 ec 08             	sub    $0x8,%esp
  8014fb:	6a 00                	push   $0x0
  8014fd:	ff 75 08             	pushl  0x8(%ebp)
  801500:	e8 fb 01 00 00       	call   801700 <open>
  801505:	89 c3                	mov    %eax,%ebx
  801507:	83 c4 10             	add    $0x10,%esp
  80150a:	85 c0                	test   %eax,%eax
  80150c:	78 1b                	js     801529 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  80150e:	83 ec 08             	sub    $0x8,%esp
  801511:	ff 75 0c             	pushl  0xc(%ebp)
  801514:	50                   	push   %eax
  801515:	e8 5d ff ff ff       	call   801477 <fstat>
  80151a:	89 c6                	mov    %eax,%esi
	close(fd);
  80151c:	89 1c 24             	mov    %ebx,(%esp)
  80151f:	e8 fd fb ff ff       	call   801121 <close>
	return r;
  801524:	83 c4 10             	add    $0x10,%esp
  801527:	89 f3                	mov    %esi,%ebx
}
  801529:	89 d8                	mov    %ebx,%eax
  80152b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80152e:	5b                   	pop    %ebx
  80152f:	5e                   	pop    %esi
  801530:	5d                   	pop    %ebp
  801531:	c3                   	ret    

00801532 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801532:	55                   	push   %ebp
  801533:	89 e5                	mov    %esp,%ebp
  801535:	56                   	push   %esi
  801536:	53                   	push   %ebx
  801537:	89 c6                	mov    %eax,%esi
  801539:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80153b:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801542:	74 27                	je     80156b <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801544:	6a 07                	push   $0x7
  801546:	68 00 50 80 00       	push   $0x805000
  80154b:	56                   	push   %esi
  80154c:	ff 35 00 40 80 00    	pushl  0x804000
  801552:	e8 d2 07 00 00       	call   801d29 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801557:	83 c4 0c             	add    $0xc,%esp
  80155a:	6a 00                	push   $0x0
  80155c:	53                   	push   %ebx
  80155d:	6a 00                	push   $0x0
  80155f:	e8 44 07 00 00       	call   801ca8 <ipc_recv>
}
  801564:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801567:	5b                   	pop    %ebx
  801568:	5e                   	pop    %esi
  801569:	5d                   	pop    %ebp
  80156a:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80156b:	83 ec 0c             	sub    $0xc,%esp
  80156e:	6a 01                	push   $0x1
  801570:	e8 0c 08 00 00       	call   801d81 <ipc_find_env>
  801575:	a3 00 40 80 00       	mov    %eax,0x804000
  80157a:	83 c4 10             	add    $0x10,%esp
  80157d:	eb c5                	jmp    801544 <fsipc+0x12>

0080157f <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  80157f:	f3 0f 1e fb          	endbr32 
  801583:	55                   	push   %ebp
  801584:	89 e5                	mov    %esp,%ebp
  801586:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801589:	8b 45 08             	mov    0x8(%ebp),%eax
  80158c:	8b 40 0c             	mov    0xc(%eax),%eax
  80158f:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801594:	8b 45 0c             	mov    0xc(%ebp),%eax
  801597:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80159c:	ba 00 00 00 00       	mov    $0x0,%edx
  8015a1:	b8 02 00 00 00       	mov    $0x2,%eax
  8015a6:	e8 87 ff ff ff       	call   801532 <fsipc>
}
  8015ab:	c9                   	leave  
  8015ac:	c3                   	ret    

008015ad <devfile_flush>:
{
  8015ad:	f3 0f 1e fb          	endbr32 
  8015b1:	55                   	push   %ebp
  8015b2:	89 e5                	mov    %esp,%ebp
  8015b4:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8015b7:	8b 45 08             	mov    0x8(%ebp),%eax
  8015ba:	8b 40 0c             	mov    0xc(%eax),%eax
  8015bd:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8015c2:	ba 00 00 00 00       	mov    $0x0,%edx
  8015c7:	b8 06 00 00 00       	mov    $0x6,%eax
  8015cc:	e8 61 ff ff ff       	call   801532 <fsipc>
}
  8015d1:	c9                   	leave  
  8015d2:	c3                   	ret    

008015d3 <devfile_stat>:
{
  8015d3:	f3 0f 1e fb          	endbr32 
  8015d7:	55                   	push   %ebp
  8015d8:	89 e5                	mov    %esp,%ebp
  8015da:	53                   	push   %ebx
  8015db:	83 ec 04             	sub    $0x4,%esp
  8015de:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8015e1:	8b 45 08             	mov    0x8(%ebp),%eax
  8015e4:	8b 40 0c             	mov    0xc(%eax),%eax
  8015e7:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8015ec:	ba 00 00 00 00       	mov    $0x0,%edx
  8015f1:	b8 05 00 00 00       	mov    $0x5,%eax
  8015f6:	e8 37 ff ff ff       	call   801532 <fsipc>
  8015fb:	85 c0                	test   %eax,%eax
  8015fd:	78 2c                	js     80162b <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8015ff:	83 ec 08             	sub    $0x8,%esp
  801602:	68 00 50 80 00       	push   $0x805000
  801607:	53                   	push   %ebx
  801608:	e8 03 f3 ff ff       	call   800910 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  80160d:	a1 80 50 80 00       	mov    0x805080,%eax
  801612:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801618:	a1 84 50 80 00       	mov    0x805084,%eax
  80161d:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801623:	83 c4 10             	add    $0x10,%esp
  801626:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80162b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80162e:	c9                   	leave  
  80162f:	c3                   	ret    

00801630 <devfile_write>:
{
  801630:	f3 0f 1e fb          	endbr32 
  801634:	55                   	push   %ebp
  801635:	89 e5                	mov    %esp,%ebp
  801637:	83 ec 0c             	sub    $0xc,%esp
  80163a:	8b 45 10             	mov    0x10(%ebp),%eax
  80163d:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801642:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801647:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80164a:	8b 55 08             	mov    0x8(%ebp),%edx
  80164d:	8b 52 0c             	mov    0xc(%edx),%edx
  801650:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801656:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  80165b:	50                   	push   %eax
  80165c:	ff 75 0c             	pushl  0xc(%ebp)
  80165f:	68 08 50 80 00       	push   $0x805008
  801664:	e8 5d f4 ff ff       	call   800ac6 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801669:	ba 00 00 00 00       	mov    $0x0,%edx
  80166e:	b8 04 00 00 00       	mov    $0x4,%eax
  801673:	e8 ba fe ff ff       	call   801532 <fsipc>
  801678:	c9                   	leave  
  801679:	c3                   	ret    

0080167a <devfile_read>:
{
  80167a:	f3 0f 1e fb          	endbr32 
  80167e:	55                   	push   %ebp
  80167f:	89 e5                	mov    %esp,%ebp
  801681:	56                   	push   %esi
  801682:	53                   	push   %ebx
  801683:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801686:	8b 45 08             	mov    0x8(%ebp),%eax
  801689:	8b 40 0c             	mov    0xc(%eax),%eax
  80168c:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801691:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801697:	ba 00 00 00 00       	mov    $0x0,%edx
  80169c:	b8 03 00 00 00       	mov    $0x3,%eax
  8016a1:	e8 8c fe ff ff       	call   801532 <fsipc>
  8016a6:	89 c3                	mov    %eax,%ebx
  8016a8:	85 c0                	test   %eax,%eax
  8016aa:	78 1f                	js     8016cb <devfile_read+0x51>
	assert(r <= n);
  8016ac:	39 f0                	cmp    %esi,%eax
  8016ae:	77 24                	ja     8016d4 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8016b0:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8016b5:	7f 33                	jg     8016ea <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8016b7:	83 ec 04             	sub    $0x4,%esp
  8016ba:	50                   	push   %eax
  8016bb:	68 00 50 80 00       	push   $0x805000
  8016c0:	ff 75 0c             	pushl  0xc(%ebp)
  8016c3:	e8 fe f3 ff ff       	call   800ac6 <memmove>
	return r;
  8016c8:	83 c4 10             	add    $0x10,%esp
}
  8016cb:	89 d8                	mov    %ebx,%eax
  8016cd:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8016d0:	5b                   	pop    %ebx
  8016d1:	5e                   	pop    %esi
  8016d2:	5d                   	pop    %ebp
  8016d3:	c3                   	ret    
	assert(r <= n);
  8016d4:	68 d8 24 80 00       	push   $0x8024d8
  8016d9:	68 df 24 80 00       	push   $0x8024df
  8016de:	6a 7c                	push   $0x7c
  8016e0:	68 f4 24 80 00       	push   $0x8024f4
  8016e5:	e8 66 eb ff ff       	call   800250 <_panic>
	assert(r <= PGSIZE);
  8016ea:	68 ff 24 80 00       	push   $0x8024ff
  8016ef:	68 df 24 80 00       	push   $0x8024df
  8016f4:	6a 7d                	push   $0x7d
  8016f6:	68 f4 24 80 00       	push   $0x8024f4
  8016fb:	e8 50 eb ff ff       	call   800250 <_panic>

00801700 <open>:
{
  801700:	f3 0f 1e fb          	endbr32 
  801704:	55                   	push   %ebp
  801705:	89 e5                	mov    %esp,%ebp
  801707:	56                   	push   %esi
  801708:	53                   	push   %ebx
  801709:	83 ec 1c             	sub    $0x1c,%esp
  80170c:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  80170f:	56                   	push   %esi
  801710:	e8 b8 f1 ff ff       	call   8008cd <strlen>
  801715:	83 c4 10             	add    $0x10,%esp
  801718:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  80171d:	7f 6c                	jg     80178b <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  80171f:	83 ec 0c             	sub    $0xc,%esp
  801722:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801725:	50                   	push   %eax
  801726:	e8 67 f8 ff ff       	call   800f92 <fd_alloc>
  80172b:	89 c3                	mov    %eax,%ebx
  80172d:	83 c4 10             	add    $0x10,%esp
  801730:	85 c0                	test   %eax,%eax
  801732:	78 3c                	js     801770 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801734:	83 ec 08             	sub    $0x8,%esp
  801737:	56                   	push   %esi
  801738:	68 00 50 80 00       	push   $0x805000
  80173d:	e8 ce f1 ff ff       	call   800910 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801742:	8b 45 0c             	mov    0xc(%ebp),%eax
  801745:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  80174a:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80174d:	b8 01 00 00 00       	mov    $0x1,%eax
  801752:	e8 db fd ff ff       	call   801532 <fsipc>
  801757:	89 c3                	mov    %eax,%ebx
  801759:	83 c4 10             	add    $0x10,%esp
  80175c:	85 c0                	test   %eax,%eax
  80175e:	78 19                	js     801779 <open+0x79>
	return fd2num(fd);
  801760:	83 ec 0c             	sub    $0xc,%esp
  801763:	ff 75 f4             	pushl  -0xc(%ebp)
  801766:	e8 f8 f7 ff ff       	call   800f63 <fd2num>
  80176b:	89 c3                	mov    %eax,%ebx
  80176d:	83 c4 10             	add    $0x10,%esp
}
  801770:	89 d8                	mov    %ebx,%eax
  801772:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801775:	5b                   	pop    %ebx
  801776:	5e                   	pop    %esi
  801777:	5d                   	pop    %ebp
  801778:	c3                   	ret    
		fd_close(fd, 0);
  801779:	83 ec 08             	sub    $0x8,%esp
  80177c:	6a 00                	push   $0x0
  80177e:	ff 75 f4             	pushl  -0xc(%ebp)
  801781:	e8 10 f9 ff ff       	call   801096 <fd_close>
		return r;
  801786:	83 c4 10             	add    $0x10,%esp
  801789:	eb e5                	jmp    801770 <open+0x70>
		return -E_BAD_PATH;
  80178b:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801790:	eb de                	jmp    801770 <open+0x70>

00801792 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801792:	f3 0f 1e fb          	endbr32 
  801796:	55                   	push   %ebp
  801797:	89 e5                	mov    %esp,%ebp
  801799:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  80179c:	ba 00 00 00 00       	mov    $0x0,%edx
  8017a1:	b8 08 00 00 00       	mov    $0x8,%eax
  8017a6:	e8 87 fd ff ff       	call   801532 <fsipc>
}
  8017ab:	c9                   	leave  
  8017ac:	c3                   	ret    

008017ad <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  8017ad:	f3 0f 1e fb          	endbr32 
  8017b1:	55                   	push   %ebp
  8017b2:	89 e5                	mov    %esp,%ebp
  8017b4:	56                   	push   %esi
  8017b5:	53                   	push   %ebx
  8017b6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  8017b9:	83 ec 0c             	sub    $0xc,%esp
  8017bc:	ff 75 08             	pushl  0x8(%ebp)
  8017bf:	e8 b3 f7 ff ff       	call   800f77 <fd2data>
  8017c4:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  8017c6:	83 c4 08             	add    $0x8,%esp
  8017c9:	68 0b 25 80 00       	push   $0x80250b
  8017ce:	53                   	push   %ebx
  8017cf:	e8 3c f1 ff ff       	call   800910 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  8017d4:	8b 46 04             	mov    0x4(%esi),%eax
  8017d7:	2b 06                	sub    (%esi),%eax
  8017d9:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  8017df:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8017e6:	00 00 00 
	stat->st_dev = &devpipe;
  8017e9:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  8017f0:	30 80 00 
	return 0;
}
  8017f3:	b8 00 00 00 00       	mov    $0x0,%eax
  8017f8:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8017fb:	5b                   	pop    %ebx
  8017fc:	5e                   	pop    %esi
  8017fd:	5d                   	pop    %ebp
  8017fe:	c3                   	ret    

008017ff <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  8017ff:	f3 0f 1e fb          	endbr32 
  801803:	55                   	push   %ebp
  801804:	89 e5                	mov    %esp,%ebp
  801806:	53                   	push   %ebx
  801807:	83 ec 0c             	sub    $0xc,%esp
  80180a:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  80180d:	53                   	push   %ebx
  80180e:	6a 00                	push   $0x0
  801810:	e8 ca f5 ff ff       	call   800ddf <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801815:	89 1c 24             	mov    %ebx,(%esp)
  801818:	e8 5a f7 ff ff       	call   800f77 <fd2data>
  80181d:	83 c4 08             	add    $0x8,%esp
  801820:	50                   	push   %eax
  801821:	6a 00                	push   $0x0
  801823:	e8 b7 f5 ff ff       	call   800ddf <sys_page_unmap>
}
  801828:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80182b:	c9                   	leave  
  80182c:	c3                   	ret    

0080182d <_pipeisclosed>:
{
  80182d:	55                   	push   %ebp
  80182e:	89 e5                	mov    %esp,%ebp
  801830:	57                   	push   %edi
  801831:	56                   	push   %esi
  801832:	53                   	push   %ebx
  801833:	83 ec 1c             	sub    $0x1c,%esp
  801836:	89 c7                	mov    %eax,%edi
  801838:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  80183a:	a1 04 40 80 00       	mov    0x804004,%eax
  80183f:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801842:	83 ec 0c             	sub    $0xc,%esp
  801845:	57                   	push   %edi
  801846:	e8 73 05 00 00       	call   801dbe <pageref>
  80184b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80184e:	89 34 24             	mov    %esi,(%esp)
  801851:	e8 68 05 00 00       	call   801dbe <pageref>
		nn = thisenv->env_runs;
  801856:	8b 15 04 40 80 00    	mov    0x804004,%edx
  80185c:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  80185f:	83 c4 10             	add    $0x10,%esp
  801862:	39 cb                	cmp    %ecx,%ebx
  801864:	74 1b                	je     801881 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801866:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801869:	75 cf                	jne    80183a <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  80186b:	8b 42 58             	mov    0x58(%edx),%eax
  80186e:	6a 01                	push   $0x1
  801870:	50                   	push   %eax
  801871:	53                   	push   %ebx
  801872:	68 12 25 80 00       	push   $0x802512
  801877:	e8 bb ea ff ff       	call   800337 <cprintf>
  80187c:	83 c4 10             	add    $0x10,%esp
  80187f:	eb b9                	jmp    80183a <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801881:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801884:	0f 94 c0             	sete   %al
  801887:	0f b6 c0             	movzbl %al,%eax
}
  80188a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80188d:	5b                   	pop    %ebx
  80188e:	5e                   	pop    %esi
  80188f:	5f                   	pop    %edi
  801890:	5d                   	pop    %ebp
  801891:	c3                   	ret    

00801892 <devpipe_write>:
{
  801892:	f3 0f 1e fb          	endbr32 
  801896:	55                   	push   %ebp
  801897:	89 e5                	mov    %esp,%ebp
  801899:	57                   	push   %edi
  80189a:	56                   	push   %esi
  80189b:	53                   	push   %ebx
  80189c:	83 ec 28             	sub    $0x28,%esp
  80189f:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  8018a2:	56                   	push   %esi
  8018a3:	e8 cf f6 ff ff       	call   800f77 <fd2data>
  8018a8:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  8018aa:	83 c4 10             	add    $0x10,%esp
  8018ad:	bf 00 00 00 00       	mov    $0x0,%edi
  8018b2:	3b 7d 10             	cmp    0x10(%ebp),%edi
  8018b5:	74 4f                	je     801906 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  8018b7:	8b 43 04             	mov    0x4(%ebx),%eax
  8018ba:	8b 0b                	mov    (%ebx),%ecx
  8018bc:	8d 51 20             	lea    0x20(%ecx),%edx
  8018bf:	39 d0                	cmp    %edx,%eax
  8018c1:	72 14                	jb     8018d7 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  8018c3:	89 da                	mov    %ebx,%edx
  8018c5:	89 f0                	mov    %esi,%eax
  8018c7:	e8 61 ff ff ff       	call   80182d <_pipeisclosed>
  8018cc:	85 c0                	test   %eax,%eax
  8018ce:	75 3b                	jne    80190b <devpipe_write+0x79>
			sys_yield();
  8018d0:	e8 5a f4 ff ff       	call   800d2f <sys_yield>
  8018d5:	eb e0                	jmp    8018b7 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  8018d7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8018da:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  8018de:	88 4d e7             	mov    %cl,-0x19(%ebp)
  8018e1:	89 c2                	mov    %eax,%edx
  8018e3:	c1 fa 1f             	sar    $0x1f,%edx
  8018e6:	89 d1                	mov    %edx,%ecx
  8018e8:	c1 e9 1b             	shr    $0x1b,%ecx
  8018eb:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  8018ee:	83 e2 1f             	and    $0x1f,%edx
  8018f1:	29 ca                	sub    %ecx,%edx
  8018f3:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  8018f7:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  8018fb:	83 c0 01             	add    $0x1,%eax
  8018fe:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801901:	83 c7 01             	add    $0x1,%edi
  801904:	eb ac                	jmp    8018b2 <devpipe_write+0x20>
	return i;
  801906:	8b 45 10             	mov    0x10(%ebp),%eax
  801909:	eb 05                	jmp    801910 <devpipe_write+0x7e>
				return 0;
  80190b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801910:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801913:	5b                   	pop    %ebx
  801914:	5e                   	pop    %esi
  801915:	5f                   	pop    %edi
  801916:	5d                   	pop    %ebp
  801917:	c3                   	ret    

00801918 <devpipe_read>:
{
  801918:	f3 0f 1e fb          	endbr32 
  80191c:	55                   	push   %ebp
  80191d:	89 e5                	mov    %esp,%ebp
  80191f:	57                   	push   %edi
  801920:	56                   	push   %esi
  801921:	53                   	push   %ebx
  801922:	83 ec 18             	sub    $0x18,%esp
  801925:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801928:	57                   	push   %edi
  801929:	e8 49 f6 ff ff       	call   800f77 <fd2data>
  80192e:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801930:	83 c4 10             	add    $0x10,%esp
  801933:	be 00 00 00 00       	mov    $0x0,%esi
  801938:	3b 75 10             	cmp    0x10(%ebp),%esi
  80193b:	75 14                	jne    801951 <devpipe_read+0x39>
	return i;
  80193d:	8b 45 10             	mov    0x10(%ebp),%eax
  801940:	eb 02                	jmp    801944 <devpipe_read+0x2c>
				return i;
  801942:	89 f0                	mov    %esi,%eax
}
  801944:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801947:	5b                   	pop    %ebx
  801948:	5e                   	pop    %esi
  801949:	5f                   	pop    %edi
  80194a:	5d                   	pop    %ebp
  80194b:	c3                   	ret    
			sys_yield();
  80194c:	e8 de f3 ff ff       	call   800d2f <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801951:	8b 03                	mov    (%ebx),%eax
  801953:	3b 43 04             	cmp    0x4(%ebx),%eax
  801956:	75 18                	jne    801970 <devpipe_read+0x58>
			if (i > 0)
  801958:	85 f6                	test   %esi,%esi
  80195a:	75 e6                	jne    801942 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  80195c:	89 da                	mov    %ebx,%edx
  80195e:	89 f8                	mov    %edi,%eax
  801960:	e8 c8 fe ff ff       	call   80182d <_pipeisclosed>
  801965:	85 c0                	test   %eax,%eax
  801967:	74 e3                	je     80194c <devpipe_read+0x34>
				return 0;
  801969:	b8 00 00 00 00       	mov    $0x0,%eax
  80196e:	eb d4                	jmp    801944 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801970:	99                   	cltd   
  801971:	c1 ea 1b             	shr    $0x1b,%edx
  801974:	01 d0                	add    %edx,%eax
  801976:	83 e0 1f             	and    $0x1f,%eax
  801979:	29 d0                	sub    %edx,%eax
  80197b:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801980:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801983:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801986:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801989:	83 c6 01             	add    $0x1,%esi
  80198c:	eb aa                	jmp    801938 <devpipe_read+0x20>

0080198e <pipe>:
{
  80198e:	f3 0f 1e fb          	endbr32 
  801992:	55                   	push   %ebp
  801993:	89 e5                	mov    %esp,%ebp
  801995:	56                   	push   %esi
  801996:	53                   	push   %ebx
  801997:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  80199a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80199d:	50                   	push   %eax
  80199e:	e8 ef f5 ff ff       	call   800f92 <fd_alloc>
  8019a3:	89 c3                	mov    %eax,%ebx
  8019a5:	83 c4 10             	add    $0x10,%esp
  8019a8:	85 c0                	test   %eax,%eax
  8019aa:	0f 88 23 01 00 00    	js     801ad3 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8019b0:	83 ec 04             	sub    $0x4,%esp
  8019b3:	68 07 04 00 00       	push   $0x407
  8019b8:	ff 75 f4             	pushl  -0xc(%ebp)
  8019bb:	6a 00                	push   $0x0
  8019bd:	e8 90 f3 ff ff       	call   800d52 <sys_page_alloc>
  8019c2:	89 c3                	mov    %eax,%ebx
  8019c4:	83 c4 10             	add    $0x10,%esp
  8019c7:	85 c0                	test   %eax,%eax
  8019c9:	0f 88 04 01 00 00    	js     801ad3 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  8019cf:	83 ec 0c             	sub    $0xc,%esp
  8019d2:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8019d5:	50                   	push   %eax
  8019d6:	e8 b7 f5 ff ff       	call   800f92 <fd_alloc>
  8019db:	89 c3                	mov    %eax,%ebx
  8019dd:	83 c4 10             	add    $0x10,%esp
  8019e0:	85 c0                	test   %eax,%eax
  8019e2:	0f 88 db 00 00 00    	js     801ac3 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8019e8:	83 ec 04             	sub    $0x4,%esp
  8019eb:	68 07 04 00 00       	push   $0x407
  8019f0:	ff 75 f0             	pushl  -0x10(%ebp)
  8019f3:	6a 00                	push   $0x0
  8019f5:	e8 58 f3 ff ff       	call   800d52 <sys_page_alloc>
  8019fa:	89 c3                	mov    %eax,%ebx
  8019fc:	83 c4 10             	add    $0x10,%esp
  8019ff:	85 c0                	test   %eax,%eax
  801a01:	0f 88 bc 00 00 00    	js     801ac3 <pipe+0x135>
	va = fd2data(fd0);
  801a07:	83 ec 0c             	sub    $0xc,%esp
  801a0a:	ff 75 f4             	pushl  -0xc(%ebp)
  801a0d:	e8 65 f5 ff ff       	call   800f77 <fd2data>
  801a12:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801a14:	83 c4 0c             	add    $0xc,%esp
  801a17:	68 07 04 00 00       	push   $0x407
  801a1c:	50                   	push   %eax
  801a1d:	6a 00                	push   $0x0
  801a1f:	e8 2e f3 ff ff       	call   800d52 <sys_page_alloc>
  801a24:	89 c3                	mov    %eax,%ebx
  801a26:	83 c4 10             	add    $0x10,%esp
  801a29:	85 c0                	test   %eax,%eax
  801a2b:	0f 88 82 00 00 00    	js     801ab3 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801a31:	83 ec 0c             	sub    $0xc,%esp
  801a34:	ff 75 f0             	pushl  -0x10(%ebp)
  801a37:	e8 3b f5 ff ff       	call   800f77 <fd2data>
  801a3c:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801a43:	50                   	push   %eax
  801a44:	6a 00                	push   $0x0
  801a46:	56                   	push   %esi
  801a47:	6a 00                	push   $0x0
  801a49:	e8 4b f3 ff ff       	call   800d99 <sys_page_map>
  801a4e:	89 c3                	mov    %eax,%ebx
  801a50:	83 c4 20             	add    $0x20,%esp
  801a53:	85 c0                	test   %eax,%eax
  801a55:	78 4e                	js     801aa5 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801a57:	a1 20 30 80 00       	mov    0x803020,%eax
  801a5c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a5f:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801a61:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a64:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801a6b:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801a6e:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801a70:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801a73:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801a7a:	83 ec 0c             	sub    $0xc,%esp
  801a7d:	ff 75 f4             	pushl  -0xc(%ebp)
  801a80:	e8 de f4 ff ff       	call   800f63 <fd2num>
  801a85:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801a88:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801a8a:	83 c4 04             	add    $0x4,%esp
  801a8d:	ff 75 f0             	pushl  -0x10(%ebp)
  801a90:	e8 ce f4 ff ff       	call   800f63 <fd2num>
  801a95:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801a98:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801a9b:	83 c4 10             	add    $0x10,%esp
  801a9e:	bb 00 00 00 00       	mov    $0x0,%ebx
  801aa3:	eb 2e                	jmp    801ad3 <pipe+0x145>
	sys_page_unmap(0, va);
  801aa5:	83 ec 08             	sub    $0x8,%esp
  801aa8:	56                   	push   %esi
  801aa9:	6a 00                	push   $0x0
  801aab:	e8 2f f3 ff ff       	call   800ddf <sys_page_unmap>
  801ab0:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801ab3:	83 ec 08             	sub    $0x8,%esp
  801ab6:	ff 75 f0             	pushl  -0x10(%ebp)
  801ab9:	6a 00                	push   $0x0
  801abb:	e8 1f f3 ff ff       	call   800ddf <sys_page_unmap>
  801ac0:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801ac3:	83 ec 08             	sub    $0x8,%esp
  801ac6:	ff 75 f4             	pushl  -0xc(%ebp)
  801ac9:	6a 00                	push   $0x0
  801acb:	e8 0f f3 ff ff       	call   800ddf <sys_page_unmap>
  801ad0:	83 c4 10             	add    $0x10,%esp
}
  801ad3:	89 d8                	mov    %ebx,%eax
  801ad5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801ad8:	5b                   	pop    %ebx
  801ad9:	5e                   	pop    %esi
  801ada:	5d                   	pop    %ebp
  801adb:	c3                   	ret    

00801adc <pipeisclosed>:
{
  801adc:	f3 0f 1e fb          	endbr32 
  801ae0:	55                   	push   %ebp
  801ae1:	89 e5                	mov    %esp,%ebp
  801ae3:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801ae6:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ae9:	50                   	push   %eax
  801aea:	ff 75 08             	pushl  0x8(%ebp)
  801aed:	e8 f6 f4 ff ff       	call   800fe8 <fd_lookup>
  801af2:	83 c4 10             	add    $0x10,%esp
  801af5:	85 c0                	test   %eax,%eax
  801af7:	78 18                	js     801b11 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801af9:	83 ec 0c             	sub    $0xc,%esp
  801afc:	ff 75 f4             	pushl  -0xc(%ebp)
  801aff:	e8 73 f4 ff ff       	call   800f77 <fd2data>
  801b04:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801b06:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801b09:	e8 1f fd ff ff       	call   80182d <_pipeisclosed>
  801b0e:	83 c4 10             	add    $0x10,%esp
}
  801b11:	c9                   	leave  
  801b12:	c3                   	ret    

00801b13 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801b13:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801b17:	b8 00 00 00 00       	mov    $0x0,%eax
  801b1c:	c3                   	ret    

00801b1d <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801b1d:	f3 0f 1e fb          	endbr32 
  801b21:	55                   	push   %ebp
  801b22:	89 e5                	mov    %esp,%ebp
  801b24:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801b27:	68 2a 25 80 00       	push   $0x80252a
  801b2c:	ff 75 0c             	pushl  0xc(%ebp)
  801b2f:	e8 dc ed ff ff       	call   800910 <strcpy>
	return 0;
}
  801b34:	b8 00 00 00 00       	mov    $0x0,%eax
  801b39:	c9                   	leave  
  801b3a:	c3                   	ret    

00801b3b <devcons_write>:
{
  801b3b:	f3 0f 1e fb          	endbr32 
  801b3f:	55                   	push   %ebp
  801b40:	89 e5                	mov    %esp,%ebp
  801b42:	57                   	push   %edi
  801b43:	56                   	push   %esi
  801b44:	53                   	push   %ebx
  801b45:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801b4b:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801b50:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801b56:	3b 75 10             	cmp    0x10(%ebp),%esi
  801b59:	73 31                	jae    801b8c <devcons_write+0x51>
		m = n - tot;
  801b5b:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801b5e:	29 f3                	sub    %esi,%ebx
  801b60:	83 fb 7f             	cmp    $0x7f,%ebx
  801b63:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801b68:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801b6b:	83 ec 04             	sub    $0x4,%esp
  801b6e:	53                   	push   %ebx
  801b6f:	89 f0                	mov    %esi,%eax
  801b71:	03 45 0c             	add    0xc(%ebp),%eax
  801b74:	50                   	push   %eax
  801b75:	57                   	push   %edi
  801b76:	e8 4b ef ff ff       	call   800ac6 <memmove>
		sys_cputs(buf, m);
  801b7b:	83 c4 08             	add    $0x8,%esp
  801b7e:	53                   	push   %ebx
  801b7f:	57                   	push   %edi
  801b80:	e8 fd f0 ff ff       	call   800c82 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801b85:	01 de                	add    %ebx,%esi
  801b87:	83 c4 10             	add    $0x10,%esp
  801b8a:	eb ca                	jmp    801b56 <devcons_write+0x1b>
}
  801b8c:	89 f0                	mov    %esi,%eax
  801b8e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b91:	5b                   	pop    %ebx
  801b92:	5e                   	pop    %esi
  801b93:	5f                   	pop    %edi
  801b94:	5d                   	pop    %ebp
  801b95:	c3                   	ret    

00801b96 <devcons_read>:
{
  801b96:	f3 0f 1e fb          	endbr32 
  801b9a:	55                   	push   %ebp
  801b9b:	89 e5                	mov    %esp,%ebp
  801b9d:	83 ec 08             	sub    $0x8,%esp
  801ba0:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801ba5:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801ba9:	74 21                	je     801bcc <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801bab:	e8 f4 f0 ff ff       	call   800ca4 <sys_cgetc>
  801bb0:	85 c0                	test   %eax,%eax
  801bb2:	75 07                	jne    801bbb <devcons_read+0x25>
		sys_yield();
  801bb4:	e8 76 f1 ff ff       	call   800d2f <sys_yield>
  801bb9:	eb f0                	jmp    801bab <devcons_read+0x15>
	if (c < 0)
  801bbb:	78 0f                	js     801bcc <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801bbd:	83 f8 04             	cmp    $0x4,%eax
  801bc0:	74 0c                	je     801bce <devcons_read+0x38>
	*(char*)vbuf = c;
  801bc2:	8b 55 0c             	mov    0xc(%ebp),%edx
  801bc5:	88 02                	mov    %al,(%edx)
	return 1;
  801bc7:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801bcc:	c9                   	leave  
  801bcd:	c3                   	ret    
		return 0;
  801bce:	b8 00 00 00 00       	mov    $0x0,%eax
  801bd3:	eb f7                	jmp    801bcc <devcons_read+0x36>

00801bd5 <cputchar>:
{
  801bd5:	f3 0f 1e fb          	endbr32 
  801bd9:	55                   	push   %ebp
  801bda:	89 e5                	mov    %esp,%ebp
  801bdc:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801bdf:	8b 45 08             	mov    0x8(%ebp),%eax
  801be2:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801be5:	6a 01                	push   $0x1
  801be7:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801bea:	50                   	push   %eax
  801beb:	e8 92 f0 ff ff       	call   800c82 <sys_cputs>
}
  801bf0:	83 c4 10             	add    $0x10,%esp
  801bf3:	c9                   	leave  
  801bf4:	c3                   	ret    

00801bf5 <getchar>:
{
  801bf5:	f3 0f 1e fb          	endbr32 
  801bf9:	55                   	push   %ebp
  801bfa:	89 e5                	mov    %esp,%ebp
  801bfc:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801bff:	6a 01                	push   $0x1
  801c01:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801c04:	50                   	push   %eax
  801c05:	6a 00                	push   $0x0
  801c07:	e8 5f f6 ff ff       	call   80126b <read>
	if (r < 0)
  801c0c:	83 c4 10             	add    $0x10,%esp
  801c0f:	85 c0                	test   %eax,%eax
  801c11:	78 06                	js     801c19 <getchar+0x24>
	if (r < 1)
  801c13:	74 06                	je     801c1b <getchar+0x26>
	return c;
  801c15:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801c19:	c9                   	leave  
  801c1a:	c3                   	ret    
		return -E_EOF;
  801c1b:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801c20:	eb f7                	jmp    801c19 <getchar+0x24>

00801c22 <iscons>:
{
  801c22:	f3 0f 1e fb          	endbr32 
  801c26:	55                   	push   %ebp
  801c27:	89 e5                	mov    %esp,%ebp
  801c29:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801c2c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c2f:	50                   	push   %eax
  801c30:	ff 75 08             	pushl  0x8(%ebp)
  801c33:	e8 b0 f3 ff ff       	call   800fe8 <fd_lookup>
  801c38:	83 c4 10             	add    $0x10,%esp
  801c3b:	85 c0                	test   %eax,%eax
  801c3d:	78 11                	js     801c50 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801c3f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c42:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801c48:	39 10                	cmp    %edx,(%eax)
  801c4a:	0f 94 c0             	sete   %al
  801c4d:	0f b6 c0             	movzbl %al,%eax
}
  801c50:	c9                   	leave  
  801c51:	c3                   	ret    

00801c52 <opencons>:
{
  801c52:	f3 0f 1e fb          	endbr32 
  801c56:	55                   	push   %ebp
  801c57:	89 e5                	mov    %esp,%ebp
  801c59:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801c5c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c5f:	50                   	push   %eax
  801c60:	e8 2d f3 ff ff       	call   800f92 <fd_alloc>
  801c65:	83 c4 10             	add    $0x10,%esp
  801c68:	85 c0                	test   %eax,%eax
  801c6a:	78 3a                	js     801ca6 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801c6c:	83 ec 04             	sub    $0x4,%esp
  801c6f:	68 07 04 00 00       	push   $0x407
  801c74:	ff 75 f4             	pushl  -0xc(%ebp)
  801c77:	6a 00                	push   $0x0
  801c79:	e8 d4 f0 ff ff       	call   800d52 <sys_page_alloc>
  801c7e:	83 c4 10             	add    $0x10,%esp
  801c81:	85 c0                	test   %eax,%eax
  801c83:	78 21                	js     801ca6 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801c85:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c88:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801c8e:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801c90:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801c93:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801c9a:	83 ec 0c             	sub    $0xc,%esp
  801c9d:	50                   	push   %eax
  801c9e:	e8 c0 f2 ff ff       	call   800f63 <fd2num>
  801ca3:	83 c4 10             	add    $0x10,%esp
}
  801ca6:	c9                   	leave  
  801ca7:	c3                   	ret    

00801ca8 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801ca8:	f3 0f 1e fb          	endbr32 
  801cac:	55                   	push   %ebp
  801cad:	89 e5                	mov    %esp,%ebp
  801caf:	56                   	push   %esi
  801cb0:	53                   	push   %ebx
  801cb1:	8b 75 08             	mov    0x8(%ebp),%esi
  801cb4:	8b 45 0c             	mov    0xc(%ebp),%eax
  801cb7:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801cba:	85 c0                	test   %eax,%eax
  801cbc:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801cc1:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801cc4:	83 ec 0c             	sub    $0xc,%esp
  801cc7:	50                   	push   %eax
  801cc8:	e8 51 f2 ff ff       	call   800f1e <sys_ipc_recv>
  801ccd:	83 c4 10             	add    $0x10,%esp
  801cd0:	85 c0                	test   %eax,%eax
  801cd2:	78 3f                	js     801d13 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801cd4:	e8 33 f0 ff ff       	call   800d0c <sys_getenvid>
  801cd9:	25 ff 03 00 00       	and    $0x3ff,%eax
  801cde:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801ce1:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801ce7:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801ced:	85 f6                	test   %esi,%esi
  801cef:	74 05                	je     801cf6 <ipc_recv+0x4e>
  801cf1:	8b 42 74             	mov    0x74(%edx),%eax
  801cf4:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801cf6:	85 db                	test   %ebx,%ebx
  801cf8:	74 0a                	je     801d04 <ipc_recv+0x5c>
  801cfa:	a1 04 40 80 00       	mov    0x804004,%eax
  801cff:	8b 40 78             	mov    0x78(%eax),%eax
  801d02:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801d04:	a1 04 40 80 00       	mov    0x804004,%eax
  801d09:	8b 40 70             	mov    0x70(%eax),%eax
}
  801d0c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801d0f:	5b                   	pop    %ebx
  801d10:	5e                   	pop    %esi
  801d11:	5d                   	pop    %ebp
  801d12:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801d13:	85 f6                	test   %esi,%esi
  801d15:	74 06                	je     801d1d <ipc_recv+0x75>
  801d17:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801d1d:	85 db                	test   %ebx,%ebx
  801d1f:	74 eb                	je     801d0c <ipc_recv+0x64>
  801d21:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801d27:	eb e3                	jmp    801d0c <ipc_recv+0x64>

00801d29 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801d29:	f3 0f 1e fb          	endbr32 
  801d2d:	55                   	push   %ebp
  801d2e:	89 e5                	mov    %esp,%ebp
  801d30:	57                   	push   %edi
  801d31:	56                   	push   %esi
  801d32:	53                   	push   %ebx
  801d33:	83 ec 0c             	sub    $0xc,%esp
  801d36:	8b 7d 08             	mov    0x8(%ebp),%edi
  801d39:	8b 75 0c             	mov    0xc(%ebp),%esi
  801d3c:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801d3f:	85 db                	test   %ebx,%ebx
  801d41:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801d46:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801d49:	ff 75 14             	pushl  0x14(%ebp)
  801d4c:	53                   	push   %ebx
  801d4d:	56                   	push   %esi
  801d4e:	57                   	push   %edi
  801d4f:	e8 a3 f1 ff ff       	call   800ef7 <sys_ipc_try_send>
  801d54:	83 c4 10             	add    $0x10,%esp
  801d57:	85 c0                	test   %eax,%eax
  801d59:	79 1e                	jns    801d79 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801d5b:	83 f8 f9             	cmp    $0xfffffff9,%eax
  801d5e:	75 07                	jne    801d67 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  801d60:	e8 ca ef ff ff       	call   800d2f <sys_yield>
  801d65:	eb e2                	jmp    801d49 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801d67:	50                   	push   %eax
  801d68:	68 36 25 80 00       	push   $0x802536
  801d6d:	6a 3b                	push   $0x3b
  801d6f:	68 4a 25 80 00       	push   $0x80254a
  801d74:	e8 d7 e4 ff ff       	call   800250 <_panic>
	}
}
  801d79:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d7c:	5b                   	pop    %ebx
  801d7d:	5e                   	pop    %esi
  801d7e:	5f                   	pop    %edi
  801d7f:	5d                   	pop    %ebp
  801d80:	c3                   	ret    

00801d81 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  801d81:	f3 0f 1e fb          	endbr32 
  801d85:	55                   	push   %ebp
  801d86:	89 e5                	mov    %esp,%ebp
  801d88:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  801d8b:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  801d90:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801d93:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801d99:	8b 52 50             	mov    0x50(%edx),%edx
  801d9c:	39 ca                	cmp    %ecx,%edx
  801d9e:	74 11                	je     801db1 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801da0:	83 c0 01             	add    $0x1,%eax
  801da3:	3d 00 04 00 00       	cmp    $0x400,%eax
  801da8:	75 e6                	jne    801d90 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801daa:	b8 00 00 00 00       	mov    $0x0,%eax
  801daf:	eb 0b                	jmp    801dbc <ipc_find_env+0x3b>
			return envs[i].env_id;
  801db1:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801db4:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801db9:	8b 40 48             	mov    0x48(%eax),%eax
}
  801dbc:	5d                   	pop    %ebp
  801dbd:	c3                   	ret    

00801dbe <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  801dbe:	f3 0f 1e fb          	endbr32 
  801dc2:	55                   	push   %ebp
  801dc3:	89 e5                	mov    %esp,%ebp
  801dc5:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  801dc8:	89 c2                	mov    %eax,%edx
  801dca:	c1 ea 16             	shr    $0x16,%edx
  801dcd:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  801dd4:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  801dd9:	f6 c1 01             	test   $0x1,%cl
  801ddc:	74 1c                	je     801dfa <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  801dde:	c1 e8 0c             	shr    $0xc,%eax
  801de1:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  801de8:	a8 01                	test   $0x1,%al
  801dea:	74 0e                	je     801dfa <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  801dec:	c1 e8 0c             	shr    $0xc,%eax
  801def:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  801df6:	ef 
  801df7:	0f b7 d2             	movzwl %dx,%edx
}
  801dfa:	89 d0                	mov    %edx,%eax
  801dfc:	5d                   	pop    %ebp
  801dfd:	c3                   	ret    
  801dfe:	66 90                	xchg   %ax,%ax

00801e00 <__udivdi3>:
  801e00:	f3 0f 1e fb          	endbr32 
  801e04:	55                   	push   %ebp
  801e05:	57                   	push   %edi
  801e06:	56                   	push   %esi
  801e07:	53                   	push   %ebx
  801e08:	83 ec 1c             	sub    $0x1c,%esp
  801e0b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  801e0f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  801e13:	8b 74 24 34          	mov    0x34(%esp),%esi
  801e17:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  801e1b:	85 d2                	test   %edx,%edx
  801e1d:	75 19                	jne    801e38 <__udivdi3+0x38>
  801e1f:	39 f3                	cmp    %esi,%ebx
  801e21:	76 4d                	jbe    801e70 <__udivdi3+0x70>
  801e23:	31 ff                	xor    %edi,%edi
  801e25:	89 e8                	mov    %ebp,%eax
  801e27:	89 f2                	mov    %esi,%edx
  801e29:	f7 f3                	div    %ebx
  801e2b:	89 fa                	mov    %edi,%edx
  801e2d:	83 c4 1c             	add    $0x1c,%esp
  801e30:	5b                   	pop    %ebx
  801e31:	5e                   	pop    %esi
  801e32:	5f                   	pop    %edi
  801e33:	5d                   	pop    %ebp
  801e34:	c3                   	ret    
  801e35:	8d 76 00             	lea    0x0(%esi),%esi
  801e38:	39 f2                	cmp    %esi,%edx
  801e3a:	76 14                	jbe    801e50 <__udivdi3+0x50>
  801e3c:	31 ff                	xor    %edi,%edi
  801e3e:	31 c0                	xor    %eax,%eax
  801e40:	89 fa                	mov    %edi,%edx
  801e42:	83 c4 1c             	add    $0x1c,%esp
  801e45:	5b                   	pop    %ebx
  801e46:	5e                   	pop    %esi
  801e47:	5f                   	pop    %edi
  801e48:	5d                   	pop    %ebp
  801e49:	c3                   	ret    
  801e4a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801e50:	0f bd fa             	bsr    %edx,%edi
  801e53:	83 f7 1f             	xor    $0x1f,%edi
  801e56:	75 48                	jne    801ea0 <__udivdi3+0xa0>
  801e58:	39 f2                	cmp    %esi,%edx
  801e5a:	72 06                	jb     801e62 <__udivdi3+0x62>
  801e5c:	31 c0                	xor    %eax,%eax
  801e5e:	39 eb                	cmp    %ebp,%ebx
  801e60:	77 de                	ja     801e40 <__udivdi3+0x40>
  801e62:	b8 01 00 00 00       	mov    $0x1,%eax
  801e67:	eb d7                	jmp    801e40 <__udivdi3+0x40>
  801e69:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801e70:	89 d9                	mov    %ebx,%ecx
  801e72:	85 db                	test   %ebx,%ebx
  801e74:	75 0b                	jne    801e81 <__udivdi3+0x81>
  801e76:	b8 01 00 00 00       	mov    $0x1,%eax
  801e7b:	31 d2                	xor    %edx,%edx
  801e7d:	f7 f3                	div    %ebx
  801e7f:	89 c1                	mov    %eax,%ecx
  801e81:	31 d2                	xor    %edx,%edx
  801e83:	89 f0                	mov    %esi,%eax
  801e85:	f7 f1                	div    %ecx
  801e87:	89 c6                	mov    %eax,%esi
  801e89:	89 e8                	mov    %ebp,%eax
  801e8b:	89 f7                	mov    %esi,%edi
  801e8d:	f7 f1                	div    %ecx
  801e8f:	89 fa                	mov    %edi,%edx
  801e91:	83 c4 1c             	add    $0x1c,%esp
  801e94:	5b                   	pop    %ebx
  801e95:	5e                   	pop    %esi
  801e96:	5f                   	pop    %edi
  801e97:	5d                   	pop    %ebp
  801e98:	c3                   	ret    
  801e99:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801ea0:	89 f9                	mov    %edi,%ecx
  801ea2:	b8 20 00 00 00       	mov    $0x20,%eax
  801ea7:	29 f8                	sub    %edi,%eax
  801ea9:	d3 e2                	shl    %cl,%edx
  801eab:	89 54 24 08          	mov    %edx,0x8(%esp)
  801eaf:	89 c1                	mov    %eax,%ecx
  801eb1:	89 da                	mov    %ebx,%edx
  801eb3:	d3 ea                	shr    %cl,%edx
  801eb5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801eb9:	09 d1                	or     %edx,%ecx
  801ebb:	89 f2                	mov    %esi,%edx
  801ebd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801ec1:	89 f9                	mov    %edi,%ecx
  801ec3:	d3 e3                	shl    %cl,%ebx
  801ec5:	89 c1                	mov    %eax,%ecx
  801ec7:	d3 ea                	shr    %cl,%edx
  801ec9:	89 f9                	mov    %edi,%ecx
  801ecb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  801ecf:	89 eb                	mov    %ebp,%ebx
  801ed1:	d3 e6                	shl    %cl,%esi
  801ed3:	89 c1                	mov    %eax,%ecx
  801ed5:	d3 eb                	shr    %cl,%ebx
  801ed7:	09 de                	or     %ebx,%esi
  801ed9:	89 f0                	mov    %esi,%eax
  801edb:	f7 74 24 08          	divl   0x8(%esp)
  801edf:	89 d6                	mov    %edx,%esi
  801ee1:	89 c3                	mov    %eax,%ebx
  801ee3:	f7 64 24 0c          	mull   0xc(%esp)
  801ee7:	39 d6                	cmp    %edx,%esi
  801ee9:	72 15                	jb     801f00 <__udivdi3+0x100>
  801eeb:	89 f9                	mov    %edi,%ecx
  801eed:	d3 e5                	shl    %cl,%ebp
  801eef:	39 c5                	cmp    %eax,%ebp
  801ef1:	73 04                	jae    801ef7 <__udivdi3+0xf7>
  801ef3:	39 d6                	cmp    %edx,%esi
  801ef5:	74 09                	je     801f00 <__udivdi3+0x100>
  801ef7:	89 d8                	mov    %ebx,%eax
  801ef9:	31 ff                	xor    %edi,%edi
  801efb:	e9 40 ff ff ff       	jmp    801e40 <__udivdi3+0x40>
  801f00:	8d 43 ff             	lea    -0x1(%ebx),%eax
  801f03:	31 ff                	xor    %edi,%edi
  801f05:	e9 36 ff ff ff       	jmp    801e40 <__udivdi3+0x40>
  801f0a:	66 90                	xchg   %ax,%ax
  801f0c:	66 90                	xchg   %ax,%ax
  801f0e:	66 90                	xchg   %ax,%ax

00801f10 <__umoddi3>:
  801f10:	f3 0f 1e fb          	endbr32 
  801f14:	55                   	push   %ebp
  801f15:	57                   	push   %edi
  801f16:	56                   	push   %esi
  801f17:	53                   	push   %ebx
  801f18:	83 ec 1c             	sub    $0x1c,%esp
  801f1b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  801f1f:	8b 74 24 30          	mov    0x30(%esp),%esi
  801f23:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  801f27:	8b 7c 24 38          	mov    0x38(%esp),%edi
  801f2b:	85 c0                	test   %eax,%eax
  801f2d:	75 19                	jne    801f48 <__umoddi3+0x38>
  801f2f:	39 df                	cmp    %ebx,%edi
  801f31:	76 5d                	jbe    801f90 <__umoddi3+0x80>
  801f33:	89 f0                	mov    %esi,%eax
  801f35:	89 da                	mov    %ebx,%edx
  801f37:	f7 f7                	div    %edi
  801f39:	89 d0                	mov    %edx,%eax
  801f3b:	31 d2                	xor    %edx,%edx
  801f3d:	83 c4 1c             	add    $0x1c,%esp
  801f40:	5b                   	pop    %ebx
  801f41:	5e                   	pop    %esi
  801f42:	5f                   	pop    %edi
  801f43:	5d                   	pop    %ebp
  801f44:	c3                   	ret    
  801f45:	8d 76 00             	lea    0x0(%esi),%esi
  801f48:	89 f2                	mov    %esi,%edx
  801f4a:	39 d8                	cmp    %ebx,%eax
  801f4c:	76 12                	jbe    801f60 <__umoddi3+0x50>
  801f4e:	89 f0                	mov    %esi,%eax
  801f50:	89 da                	mov    %ebx,%edx
  801f52:	83 c4 1c             	add    $0x1c,%esp
  801f55:	5b                   	pop    %ebx
  801f56:	5e                   	pop    %esi
  801f57:	5f                   	pop    %edi
  801f58:	5d                   	pop    %ebp
  801f59:	c3                   	ret    
  801f5a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  801f60:	0f bd e8             	bsr    %eax,%ebp
  801f63:	83 f5 1f             	xor    $0x1f,%ebp
  801f66:	75 50                	jne    801fb8 <__umoddi3+0xa8>
  801f68:	39 d8                	cmp    %ebx,%eax
  801f6a:	0f 82 e0 00 00 00    	jb     802050 <__umoddi3+0x140>
  801f70:	89 d9                	mov    %ebx,%ecx
  801f72:	39 f7                	cmp    %esi,%edi
  801f74:	0f 86 d6 00 00 00    	jbe    802050 <__umoddi3+0x140>
  801f7a:	89 d0                	mov    %edx,%eax
  801f7c:	89 ca                	mov    %ecx,%edx
  801f7e:	83 c4 1c             	add    $0x1c,%esp
  801f81:	5b                   	pop    %ebx
  801f82:	5e                   	pop    %esi
  801f83:	5f                   	pop    %edi
  801f84:	5d                   	pop    %ebp
  801f85:	c3                   	ret    
  801f86:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801f8d:	8d 76 00             	lea    0x0(%esi),%esi
  801f90:	89 fd                	mov    %edi,%ebp
  801f92:	85 ff                	test   %edi,%edi
  801f94:	75 0b                	jne    801fa1 <__umoddi3+0x91>
  801f96:	b8 01 00 00 00       	mov    $0x1,%eax
  801f9b:	31 d2                	xor    %edx,%edx
  801f9d:	f7 f7                	div    %edi
  801f9f:	89 c5                	mov    %eax,%ebp
  801fa1:	89 d8                	mov    %ebx,%eax
  801fa3:	31 d2                	xor    %edx,%edx
  801fa5:	f7 f5                	div    %ebp
  801fa7:	89 f0                	mov    %esi,%eax
  801fa9:	f7 f5                	div    %ebp
  801fab:	89 d0                	mov    %edx,%eax
  801fad:	31 d2                	xor    %edx,%edx
  801faf:	eb 8c                	jmp    801f3d <__umoddi3+0x2d>
  801fb1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  801fb8:	89 e9                	mov    %ebp,%ecx
  801fba:	ba 20 00 00 00       	mov    $0x20,%edx
  801fbf:	29 ea                	sub    %ebp,%edx
  801fc1:	d3 e0                	shl    %cl,%eax
  801fc3:	89 44 24 08          	mov    %eax,0x8(%esp)
  801fc7:	89 d1                	mov    %edx,%ecx
  801fc9:	89 f8                	mov    %edi,%eax
  801fcb:	d3 e8                	shr    %cl,%eax
  801fcd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  801fd1:	89 54 24 04          	mov    %edx,0x4(%esp)
  801fd5:	8b 54 24 04          	mov    0x4(%esp),%edx
  801fd9:	09 c1                	or     %eax,%ecx
  801fdb:	89 d8                	mov    %ebx,%eax
  801fdd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801fe1:	89 e9                	mov    %ebp,%ecx
  801fe3:	d3 e7                	shl    %cl,%edi
  801fe5:	89 d1                	mov    %edx,%ecx
  801fe7:	d3 e8                	shr    %cl,%eax
  801fe9:	89 e9                	mov    %ebp,%ecx
  801feb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  801fef:	d3 e3                	shl    %cl,%ebx
  801ff1:	89 c7                	mov    %eax,%edi
  801ff3:	89 d1                	mov    %edx,%ecx
  801ff5:	89 f0                	mov    %esi,%eax
  801ff7:	d3 e8                	shr    %cl,%eax
  801ff9:	89 e9                	mov    %ebp,%ecx
  801ffb:	89 fa                	mov    %edi,%edx
  801ffd:	d3 e6                	shl    %cl,%esi
  801fff:	09 d8                	or     %ebx,%eax
  802001:	f7 74 24 08          	divl   0x8(%esp)
  802005:	89 d1                	mov    %edx,%ecx
  802007:	89 f3                	mov    %esi,%ebx
  802009:	f7 64 24 0c          	mull   0xc(%esp)
  80200d:	89 c6                	mov    %eax,%esi
  80200f:	89 d7                	mov    %edx,%edi
  802011:	39 d1                	cmp    %edx,%ecx
  802013:	72 06                	jb     80201b <__umoddi3+0x10b>
  802015:	75 10                	jne    802027 <__umoddi3+0x117>
  802017:	39 c3                	cmp    %eax,%ebx
  802019:	73 0c                	jae    802027 <__umoddi3+0x117>
  80201b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80201f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802023:	89 d7                	mov    %edx,%edi
  802025:	89 c6                	mov    %eax,%esi
  802027:	89 ca                	mov    %ecx,%edx
  802029:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80202e:	29 f3                	sub    %esi,%ebx
  802030:	19 fa                	sbb    %edi,%edx
  802032:	89 d0                	mov    %edx,%eax
  802034:	d3 e0                	shl    %cl,%eax
  802036:	89 e9                	mov    %ebp,%ecx
  802038:	d3 eb                	shr    %cl,%ebx
  80203a:	d3 ea                	shr    %cl,%edx
  80203c:	09 d8                	or     %ebx,%eax
  80203e:	83 c4 1c             	add    $0x1c,%esp
  802041:	5b                   	pop    %ebx
  802042:	5e                   	pop    %esi
  802043:	5f                   	pop    %edi
  802044:	5d                   	pop    %ebp
  802045:	c3                   	ret    
  802046:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80204d:	8d 76 00             	lea    0x0(%esi),%esi
  802050:	29 fe                	sub    %edi,%esi
  802052:	19 c3                	sbb    %eax,%ebx
  802054:	89 f2                	mov    %esi,%edx
  802056:	89 d9                	mov    %ebx,%ecx
  802058:	e9 1d ff ff ff       	jmp    801f7a <__umoddi3+0x6a>
